http.createServer((req, res) => { const { filename } = req.headers console.log(`File request received: ${filename}`) req .pipe(crypto.createDecipher('aes-192-gcm', 'secret')) .pipe(zlib.createGunzip()) .pipe(fs.createWriteStream(filename)) .on('finish', () => { res.writeHead(201, { 'Content-Type': 'text/plain' }) res.end('That\'s it\n') console.log(`File saved: ${filename}`) }) })