HTTP Compression library for Node.js (v10+)
Supports Brotli, Gzip, and Deflate
consthttp=require('http');constCompression=require('@nicksrandall/compression');constcompression=Compression({/* optional zlib settings */});constserver=http.createServer(compression((req,res)=>{// your request listener}));server.listen(3000);This library is basically a typescript re-write of the very popular compression library on NPM maintained by the Express.js team.
I couldn't have done this without their work.