migrating from through to streams2

This commit is contained in:
Alex Kocharin 2013-09-27 12:54:16 +04:00
parent 35235db7a0
commit b7e4bfdd14
2 changed files with 43 additions and 0 deletions

38
lib/streams.js Normal file
View File

@ -0,0 +1,38 @@
var stream = require('stream');
var util = require('util');
//
// This stream is used to read tarballs from repository
//
function ReadTarball(options) {
stream.PassThrough.call(this, options);
}
// called when data is not needed anymore
UploadTarball.prototype.abort = function() {
this.emit('error', new Error('not implemented'));
};
util.inherits(ReadTarball, stream.PassThrough);
module.exports.ReadTarballStream = ReadTarball;
//
// This stream is used to upload tarballs to a repository
//
function UploadTarball(options) {
stream.Writable.call(this, options);
}
// called when user closes connection before upload finishes
UploadTarball.prototype.abort = function() {
this.emit('error', new Error('not implemented'));
};
// called when upload finishes successfully
UploadTarball.prototype.done = function() {
this.emit('error', new Error('not implemented'));
};
util.inherits(UploadTarball, stream.Writable);
module.exports.UploadTarballStream = UploadTarball;

View File

@ -43,6 +43,11 @@ keywords:
scripts:
test: ./test/start.sh
# we depend on streams2 stuff
# it can be replaced with isaacs/readable-stream, ask if you need to use 0.8
engines:
node: '>=0.10'
preferGlobal: true
license: BSD