UNPKG

rjweb-server

Version:

Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS

26 lines (25 loc) 526 B
import { PassThrough } from "stream"; import zlib from "zlib"; const DecompressMapping = { "x-gzip": "gzip", gzip: "gzip", br: "brotli", inflate: "inflate", none: "none" }; function handleDecompressType(type) { switch (type) { case "gzip": return zlib.createGunzip(); case "brotli": return zlib.createBrotliDecompress(); case "inflate": return zlib.createInflate(); default: return new PassThrough(); } } export { DecompressMapping, handleDecompressType as default };