https://github.com/indexzero/npm-publish-split-stream
Splits an npm publish request using jsonstream and duplexify
https://github.com/indexzero/npm-publish-split-stream
Last synced: about 1 year ago
JSON representation
Splits an npm publish request using jsonstream and duplexify
- Host: GitHub
- URL: https://github.com/indexzero/npm-publish-split-stream
- Owner: indexzero
- License: mit
- Created: 2015-07-17T10:21:30.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-09-20T18:48:17.000Z (over 10 years ago)
- Last Synced: 2025-03-17T09:52:17.486Z (over 1 year ago)
- Language: JavaScript
- Size: 119 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# npm-publish-split-stream
Splits an npm publish request using jsonstream and duplexify.
## Usage
``` js
var PublishSplitStream = require('npm-publish-split-stream');
var http = require('http');
var zlib = require('zlib');
var tar = require('tar');
var concat = require('concat-stream');
http.createServer(function (req, res) {
//
// Create a tar parser and listen for
// entries from it.
//
var parser = tar.Parse();
parser.on('entry', function (e) {
// read the entire entry and log the contents.
e.pipe(concat({ encoding: 'string' }, function (content) {
console.log(e.path, content)
}));
});
//
// Parse the tarball from our request and then
// process it.
//
req.pipe(new PublishSplitStream())
.pipe(zlib.Unzip())
.pipe(parser);
});
```
##### Author: [Charlie Robbins](https://github.com/indexzero)
##### Contributors: [Martijn Swaagman](https://github.com/swaagie), [Arnout Kazemier](https://github.com/3rd-eden)
##### LICENSE: MIT