1.0.1 • Published 9 years ago

npm-publish-split-stream v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

npm-publish-split-stream

Splits an npm publish request using jsonstream and duplexify.

Usage

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
Contributors: Martijn Swaagman, Arnout Kazemier
LICENSE: MIT