1.0.7 • Published 7 years ago

salam v1.0.7

Weekly downloads
14
License
MIT
Repository
github
Last release
7 years ago

Salam License NPM version Dependency Status Build Status

Pack and extract zip archives middleware based on socket.io and onezip.

Install

npm i salam --save

Client

Could be loaded from url /salam/salam.js.

const prefix = '/salam';

salam(prefix, (packer) => {
    const from = '/';
    const to = '/tmp';
    const names = [
        'bin'
    ];
    
    const progress = (value) => {
        console.log('progress:', value);
    };
    
    const end = () => {
        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);
    });
});

Server

const salam = require('salam');
const http = require('http');
const express = require('express');
const io = require('socket.io');
const app = express();
const server = http.createServer(app);
const socket = io.listen(server);

server.listen(1337);

app.use(salam({
    authCheck: (socket, success) => {
        success();
    }
});

salam.listen(socket, {
    prefix: '/salam',   /* default              */
    root: '/',          /* string or function   */
});

Environments

In old node.js environments that not fully supports es2015, salam could be used with:

var salam = require('salam/legacy');

Related

  • Ishtar - Pack and extract .tar.gz archives middleware.

License

MIT

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago