An open API service indexing awesome lists of open source software.

https://github.com/cloudcmd/node-omnes

extract zip, gz, tar, tar.gz, tgz archives middleware. better use https://github.com/cloudcmd/node-fileop
https://github.com/cloudcmd/node-omnes

cloudcmd gzip javascript middleware nodejs tar zip

Last synced: 9 months ago
JSON representation

extract zip, gz, tar, tar.gz, tgz archives middleware. better use https://github.com/cloudcmd/node-fileop

Awesome Lists containing this project

README

          

# Omnes [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL]

Extract `zip`, `tar`, `gz`, `tar.gz`, `tgz` archives middleware based on [socket.io](http://socket.io "Socket.io") and [inly](https://github.com/coderaiser/node-inly "Inly").

## Install

```
npm i omnes --save
```

## Client

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

```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

```js
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:

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

## Related

- [Ishtar](https://github.com/coderaiser/node-ishtar "Ishtar") - Pack and extract .tar.gz archives middleware.
- [Salam](https://github.com/coderaiser/node-salam "Salam") Pack and extract `zip` archives middleware.

## License

MIT

[NPMIMGURL]: https://img.shields.io/npm/v/omnes.svg?style=flat
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[NPMURL]: https://npmjs.org/package/omnes "npm"
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"

[BuildStatusURL]: https://travis-ci.org/cloudcmd/node-omnes "Build Status"
[BuildStatusIMGURL]: https://img.shields.io/travis/cloudcmd/node-omnes/master.svg?style=flat