NodeJS implémente quelques streams et fonctionnalités de transformation
constcrypto=require('crypto');constfs=require('fs');constzlib=require('zlib');constpassword=newBuffer(process.env.PASS||'password');constencryptStream=crypto.createCipher('aes-256-cbc', password);constgzip=zlib.createGzip();constreadStream=fs.createReadStream('secret-data.txt');constwriteStream=fs.createWriteStream('encrypted-secret-data.gz');/* Read current file. */readStream/* Encrypt data. */.pipe(encryptStream)/* Compress data. */.pipe(gzip)/* Write data to output file. */.pipe(writeStream)/* We are done. */.on('finish',function () {console.log('done'); });