Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coderaiser/node-salam
pack and extract zip archives middleware
https://github.com/coderaiser/node-salam
expressjs extract javascript middleware nodejs pack zip
Last synced: 22 days ago
JSON representation
pack and extract zip archives middleware
- Host: GitHub
- URL: https://github.com/coderaiser/node-salam
- Owner: coderaiser
- License: mit
- Created: 2016-11-17T14:11:09.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-25T07:51:04.000Z (over 6 years ago)
- Last Synced: 2024-10-01T18:08:55.229Z (about 1 month ago)
- Topics: expressjs, extract, javascript, middleware, nodejs, pack, zip
- Language: JavaScript
- Size: 25.4 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: LICENSE
Awesome Lists containing this project
README
# Salam [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL]
Pack and extract `zip` archives middleware based on [socket.io](http://socket.io "Socket.io") and [onezip](https://github.com/coderaiser/node-onezip "OneZip").
## Install
```
npm i salam --save
```## Client
Could be loaded from url `/salam/salam.js`.
```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
```js
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:
```js
var salam = require('salam/legacy');
```## Related
- [Ishtar](https://github.com/coderaiser/node-ishtar "Ishtar") - Pack and extract .tar.gz archives middleware.
## License
MIT
[NPMIMGURL]: https://img.shields.io/npm/v/salam.svg?style=flat
[DependencyStatusIMGURL]: https://img.shields.io/gemnasium/coderaiser/node-salam.svg?style=flat
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[NPMURL]: https://npmjs.org/package/salam "npm"
[DependencyStatusURL]: https://gemnasium.com/coderaiser/node-salam "Dependency Status"
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"[BuildStatusURL]: https://travis-ci.org/coderaiser/node-salam "Build Status"
[BuildStatusIMGURL]: https://img.shields.io/travis/coderaiser/node-salam/master.svg?style=flat