Pack and extract zip archives middleware based on socket.io and onezip.
npm i salam --save
Could be loaded from url /salam/salam.js.
constprefix='/salam';salam(prefix,(packer)=>{constfrom='/';constto='/tmp';constnames=['bin'];constprogress=(value)=>{console.log('progress:',value);};constend=()=>{console.log('end');packer.removeListener('progress',progress);packer.removeListener('end',end);};packer.pack(from,to,names);packer.on('progress',progress);packer.on('end',end);packer.on('error',(error)=>{console.error(error.message);});});constsalam=require('salam');consthttp=require('http');constexpress=require('express');constio=require('socket.io');constapp=express();constserver=http.createServer(app);constsocket=io.listen(server);server.listen(1337);app.use(salam({authCheck: (socket,success)=>{success();}});salam.listen(socket,{prefix: '/salam',/* default */root: '/',/* string or function */});In old node.js environments that not fully supports es2015, salam could be used with:
varsalam=require('salam/legacy');- Ishtar - Pack and extract .tar.gz archives middleware.
MIT