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
- Host: GitHub
- URL: https://github.com/cloudcmd/node-omnes
- Owner: cloudcmd
- License: mit
- Created: 2017-01-27T12:01:14.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-05-02T11:43:32.000Z (over 7 years ago)
- Last Synced: 2025-01-25T14:34:06.804Z (about 1 year ago)
- Topics: cloudcmd, gzip, javascript, middleware, nodejs, tar, zip
- Language: JavaScript
- Homepage:
- Size: 20.5 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: LICENSE
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