npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

omnes

1.0.9 • Public • Published

Omnes License NPM version Dependency Status Build Status

Extract zip, tar, gz, tar.gz, tgz archives middleware based on socket.io and inly.

Install

npm i omnes --save

Client

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

const prefix = '/omnes';
 
omnes(prefix, function(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 omnes = require('omnes');
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(omnes({
    authCheck: (socket, success) => {
        success();
    }
});
 
omnes.listen(socket, {
    prefix: '/omnes',   /* default              */
    root: '/',          /* string or function   */
});

Environments

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

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

Related

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

License

MIT

install

npm i omnes

Downloadsweekly downloads

33

version

1.0.9

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability