Socket
Socket
Sign inDemoInstall

electron-updater

Package Overview
Dependencies
Maintainers
1
Versions
290
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-updater - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

node_modules/got/license

5

index.js

@@ -33,2 +33,3 @@ var commands = require('./lib/commands.js'),

// name: appName,
// publisher: publisher,
// exe: process.execPath,

@@ -40,3 +41,3 @@ // cwd: process.cwd(),

var appDir = directory.appDir(args.appName)
var appDir = directory.appDir(args.publisher, args.appName)
var pendingUpdatePath = path.join(appDir, '.update')

@@ -85,3 +86,3 @@ var logger = new Logger(appDir, Logger.appendToFile, args.debug)

// relaunch self as an elevated process
launch.elevate(args.appName, process.execPath, elevatedArgs, process.cwd(), function (err) {
launch.elevate(args.publisher, args.appName, process.execPath, elevatedArgs, process.cwd(), function (err) {
if(err) return logger.log(err)

@@ -88,0 +89,0 @@ // Watch for changes to the .update file, it will become empty when the update succeeds.

3

lib/check.js

@@ -76,4 +76,5 @@ var semver = require('semver'),

var registry = this.registry
var publisher = this.publisher
var desired = this.plugins[name]
var appData = directory.appDir(appName)
var appData = directory.appDir(publisher, appName)
var currentPluginsPath = path.join(appData, '.current')

@@ -80,0 +81,0 @@ file.readJson(currentPluginsPath, function (err, data) {

@@ -136,4 +136,4 @@ var util = require('util'),

function fullUpdate(appName, logger, callback) {
copier.copy(process.execPath, appName, function (err, tmpExecPath) {
function fullUpdate(publisher, appName, logger, callback) {
copier.copy(process.execPath, publisher, appName, function (err, tmpExecPath) {
if(err) return callback(err)

@@ -176,3 +176,3 @@ var updateDir = path.resolve(path.join(__dirname, '..'))

// This is set when a dependency update is available.
fullUpdate(ctx.name, logger, function (err) {
fullUpdate(ctx.publisher, ctx.name, logger, function (err) {
if(err) return callback(err)

@@ -203,3 +203,3 @@ that.emit('updateRequired')

// restart and do the full update process to update those.
var appData = directory.appDir(ctx.name)
var appData = directory.appDir(ctx.publisher, ctx.name)
var pendingUpdatePath = path.join(appData, '.update')

@@ -224,3 +224,3 @@ file.touch(pendingUpdatePath, 'PENDING', function (err) {

} else {
fullUpdate(ctx.name, logger, function (err) {
fullUpdate(ctx.publisher, ctx.name, logger, function (err) {
if(err) return callback(err)

@@ -227,0 +227,0 @@ that.emit('updateRequired')

@@ -47,7 +47,9 @@ var directory = require('./directory.js'),

var version = package.version
var appData = directory.appDir(name)
var publisher = package.publisher || name
var defaultChannel = package.defaultChannel || 'latest'
var appData = directory.appDir(publisher, name)
var pendingUpdatePath = path.join(appData, '.update')
var channelPath = path.join(appData, '.channel')
fs.readFile(channelPath, {encoding: 'utf8'}, function (err, channel) {
channel = channel || 'latest'
channel = channel || defaultChannel
fs.readFile(pendingUpdatePath, {encoding: 'utf8'}, function (err, updateContents) {

@@ -59,2 +61,3 @@ var updatePending = !err && updateContents === 'PENDING'

version: version,
publisher: publisher,
channel: channel,

@@ -61,0 +64,0 @@ dev: dev,

@@ -45,5 +45,5 @@ var directory = require('./directory.js'),

function copy(execPath, appName, callback) {
function copy(execPath, publisher, appName, callback) {
var execDir = path.join(path.dirname(execPath))
var appData = directory.appDir(appName)
var appData = directory.appDir(publisher, appName)
var electronVersion = process.versions.electron

@@ -50,0 +50,0 @@ var updateDir = path.join(appData, 'updater', electronVersion)

@@ -44,5 +44,8 @@

function appDir(appName) {
var dirs = new AppDirectory(appName)
return path.dirname(dirs.userData())
function appDir(publisher, appName) {
var dirs = new AppDirectory({
appName: appName,
appAuthor: publisher
})
return dirs.userData()
}

@@ -49,0 +52,0 @@

@@ -27,5 +27,6 @@ var async = require('async')

var appVersion = this.version
var publisher = this.publisher
var plugins = this.plugins
var desired = this.plugins[name]
var appData = directory.appDir(appName)
var appData = directory.appDir(publisher, appName)
var currentPluginsPath = path.join(appData, '.current')

@@ -32,0 +33,0 @@ file.readJson(currentPluginsPath, function (err, data) {

@@ -15,6 +15,6 @@

function elevateWindows(appName, process, argv, cwd, callback) {
function elevateWindows(publisher, appName, process, argv, cwd, callback) {
exec('net session', function (error) {
if(error) {
var appDir = directory.appDir(appName)
var appDir = directory.appDir(publisher, appName)
var updateScript = path.join(appDir, 'update.vbs')

@@ -44,6 +44,6 @@ var args = escape(argv)

function elevate(appName, process, argv, cwd, callback) {
function elevate(publisher, appName, process, argv, cwd, callback) {
switch(os.platform()) {
case 'win32':
elevateWindows(appName, process, argv, cwd, callback)
elevateWindows(publisher, appName, process, argv, cwd, callback)
break

@@ -50,0 +50,0 @@ default:

@@ -45,3 +45,3 @@ var util = require('util'),

function updatePlugin(name, version, context, logger, callback) {
var appData = directory.appDir(context.name)
var appData = directory.appDir(context.publisher, context.name)
var pluginsDir = path.join(appData, 'plugins')

@@ -48,0 +48,0 @@ var dir = path.join(pluginsDir, name, version)

@@ -8,3 +8,3 @@ {

"type": "git",
"url": "http://github.com/MrJohz/appdirectory.git"
"url": "git+ssh://git@github.com/MrJohz/appdirectory.git"
},

@@ -11,0 +11,0 @@ "scripts": {

@@ -60,3 +60,3 @@ {

"_shasum": "aea74d5e61c1f899613bf64bda66d4c78f2fd17d",
"_from": "async@0.9.2",
"_from": "async@>=0.9.0 <0.10.0",
"_npmVersion": "2.9.0",

@@ -63,0 +63,0 @@ "_nodeVersion": "2.0.1",

@@ -17,2 +17,3 @@ 'use strict';

var statuses = require('statuses');
var isRedirect = require('is-redirect');
var NestedErrorStacks = require('nested-error-stacks');

@@ -38,3 +39,9 @@

opts = objectAssign({}, opts);
opts = objectAssign(
{
protocol: 'http:'
},
typeof url === 'string' ? urlLib.parse(prependHttp(url)) : url,
opts
);

@@ -46,2 +53,15 @@ opts.headers = objectAssign({

if (opts.pathname) {
opts.path = opts.pathname;
}
if (opts.query) {
if (typeof opts.query !== 'string') {
opts.query = querystring.stringify(opts.query);
}
opts.path = opts.pathname + '?' + opts.query;
delete opts.query;
}
var encoding = opts.encoding;

@@ -51,3 +71,2 @@ var body = opts.body;

var timeout = opts.timeout;
var query = opts.query;
var proxy;

@@ -60,3 +79,2 @@ var redirectCount = 0;

delete opts.timeout;
delete opts.query;

@@ -68,6 +86,16 @@ if (json) {

if (body) {
if (typeof body !== 'string' && !Buffer.isBuffer(body) && !isStream.readable(body)) {
throw new GotError('options.body must be a ReadableStream, string or Buffer');
}
opts.method = opts.method || 'POST';
if (!opts.headers['content-length'] && !opts.headers['transfer-encoding'] && !isStream.readable(body)) {
var length = typeof body === 'string' ? Buffer.byteLength(body) : body.length;
opts.headers['content-length'] = length;
}
}
opts.method = opts.method || 'GET';
// returns a proxy stream to the response

@@ -77,2 +105,3 @@ // if no callback has been provided

proxy = duplexify();
// forward errors on the stream

@@ -88,16 +117,9 @@ cb = function (err, data, response) {

if (body && !(typeof body === 'string' || Buffer.isBuffer(body) || isStream.readable(body))) {
throw new GotError('options.body must be a ReadableStream, string or Buffer');
}
function get(opts, cb) {
var fn = opts.protocol === 'https:' ? https : http;
var url = urlLib.format(opts);
function get(url, opts, cb) {
var parsedUrl = typeof url === 'string' ? urlLib.parse(prependHttp(url)) : url;
var fn = parsedUrl.protocol === 'https:' ? https : http;
var arg = objectAssign({}, parsedUrl, opts);
if (opts.agent === undefined) {
opts.agent = infinityAgent[fn === https ? 'https' : 'http'].globalAgent;
url = typeof url === 'string' ? prependHttp(url) : urlLib.format(url);
if (arg.agent === undefined) {
arg.agent = infinityAgent[fn === https ? 'https' : 'http'].globalAgent;
if (process.version.indexOf('v0.10') === 0 && fn === https && (

@@ -111,12 +133,15 @@ typeof opts.ca !== 'undefined' ||

typeof opts.rejectUnauthorized !== 'undefined')) {
arg.agent = new (infinityAgent.https.Agent)(opts);
opts.agent = new infinityAgent.https.Agent({
ca: opts.ca,
cert: opts.cert,
ciphers: opts.ciphers,
key: opts.key,
passphrase: opts.passphrase,
pfx: opts.pfx,
rejectUnauthorized: opts.rejectUnauthorized
});
}
}
if (query) {
arg.path = (arg.path ? arg.path.split('?')[0] : '') + '?' + (typeof query === 'string' ? query : querystring.stringify(query));
query = undefined;
}
var req = fn.request(arg, function (response) {
var req = fn.request(opts, function (response) {
var statusCode = response.statusCode;

@@ -128,5 +153,7 @@ var res = response;

}
// auto-redirect only for GET and HEAD methods
if (statuses.redirect[statusCode] && 'location' in res.headers && (opts.method === 'GET' || opts.method === 'HEAD')) {
res.resume(); // discard response
if (isRedirect(statusCode) && 'location' in res.headers && (opts.method === 'GET' || opts.method === 'HEAD')) {
// discard response
res.resume();

@@ -138,12 +165,10 @@ if (++redirectCount > 10) {

delete opts.host;
delete opts.hostname;
delete opts.port;
delete opts.path;
var redirectUrl = urlLib.resolve(url, res.headers.location);
var redirectOpts = objectAssign(opts, urlLib.parse(redirectUrl));
if (proxy) {
proxy.emit('redirect', res, opts);
proxy.emit('redirect', res, redirectOpts);
}
get(urlLib.resolve(url, res.headers.location), opts, cb);
get(redirectOpts, cb);
return;

@@ -174,2 +199,3 @@ }

}
// pipe the response to the proxy if in proxy mode

@@ -234,3 +260,4 @@ if (proxy) {

get(url, opts, cb);
get(opts, cb);
return proxy;

@@ -237,0 +264,0 @@ }

@@ -18,3 +18,3 @@ {

"type": "git",
"url": "https://github.com/npm/wrappy"
"url": "git+https://github.com/npm/wrappy.git"
},

@@ -21,0 +21,0 @@ "author": {

@@ -1,22 +0,1 @@

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// a duplex stream is just a stream that is both readable and writable.

@@ -27,3 +6,3 @@ // Since JS doesn't have multiple prototypal inheritance, this class

module.exports = Duplex;
'use strict';

@@ -39,3 +18,11 @@ /*<replacement>*/

module.exports = Duplex;
/*<replacement>*/
var processNextTick = require('process-nextick-args');
/*</replacement>*/
/*<replacement>*/
var util = require('core-util-is');

@@ -50,6 +37,8 @@ util.inherits = require('inherits');

forEach(objectKeys(Writable.prototype), function(method) {
var keys = objectKeys(Writable.prototype);
for (var v = 0; v < keys.length; v++) {
var method = keys[v];
if (!Duplex.prototype[method])
Duplex.prototype[method] = Writable.prototype[method];
});
}

@@ -85,5 +74,9 @@ function Duplex(options) {

// But allow more writes to happen in this tick.
process.nextTick(this.end.bind(this));
processNextTick(onEndNT, this);
}
function onEndNT(self) {
self.end();
}
function forEach (xs, f) {

@@ -90,0 +83,0 @@ for (var i = 0, l = xs.length; i < l; i++) {

@@ -1,22 +0,1 @@

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// a passthrough stream.

@@ -26,2 +5,4 @@ // basically just the most minimal sort of Transform stream.

'use strict';
module.exports = PassThrough;

@@ -28,0 +9,0 @@

@@ -1,21 +0,2 @@

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';

@@ -25,2 +6,7 @@ module.exports = Readable;

/*<replacement>*/
var processNextTick = require('process-nextick-args');
/*</replacement>*/
/*<replacement>*/
var isArray = require('isarray');

@@ -44,5 +30,14 @@ /*</replacement>*/

var Stream = require('stream');
/*<replacement>*/
var Stream;
(function (){try{
Stream = require('st' + 'ream');
}catch(_){Stream = require('events').EventEmitter;}}())
/*</replacement>*/
var Buffer = require('buffer').Buffer;
/*<replacement>*/
var util = require('core-util-is');

@@ -52,3 +47,2 @@ util.inherits = require('inherits');

var StringDecoder;

@@ -65,2 +59,3 @@

var StringDecoder;

@@ -74,6 +69,13 @@ util.inherits(Readable, Stream);

// object stream flag. Used to make read(n) ignore n and to
// make all the buffer merging and length checks go away
this.objectMode = !!options.objectMode;
if (stream instanceof Duplex)
this.objectMode = this.objectMode || !!options.readableObjectMode;
// the point at which it stops calling _read() to fill the buffer
// Note: 0 is a valid value, means "don't call _read preemptively ever"
var hwm = options.highWaterMark;
var defaultHwm = options.objectMode ? 16 : 16 * 1024;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;

@@ -105,10 +107,2 @@

// object stream flag. Used to make read(n) ignore n and to
// make all the buffer merging and length checks go away
this.objectMode = !!options.objectMode;
if (stream instanceof Duplex)
this.objectMode = this.objectMode || !!options.readableObjectMode;
// Crypto is kind of old and crusty. Historically, its default string

@@ -150,2 +144,5 @@ // encoding is 'binary' so we have to make this configurable.

if (options && typeof options.read === 'function')
this._read = options.read;
Stream.call(this);

@@ -161,3 +158,3 @@ }

if (util.isString(chunk) && !state.objectMode) {
if (!state.objectMode && typeof chunk === 'string') {
encoding = encoding || state.defaultEncoding;

@@ -179,2 +176,6 @@ if (encoding !== state.encoding) {

Readable.prototype.isPaused = function() {
return this._readableState.flowing === false;
};
function readableAddChunk(stream, state, chunk, encoding, addToFront) {

@@ -184,6 +185,5 @@ var er = chunkInvalid(state, chunk);

stream.emit('error', er);
} else if (util.isNullOrUndefined(chunk)) {
} else if (chunk === null) {
state.reading = false;
if (!state.ended)
onEofChunk(stream, state);
onEofChunk(stream, state);
} else if (state.objectMode || chunk && chunk.length > 0) {

@@ -274,3 +274,3 @@ if (state.ended && !addToFront) {

if (isNaN(n) || util.isNull(n)) {
if (n === null || isNaN(n)) {
// only flow one buffer at a time

@@ -298,4 +298,5 @@ if (state.flowing && state.buffer.length)

return 0;
} else
} else {
return state.length;
}
}

@@ -312,3 +313,3 @@

if (!util.isNumber(n) || n > 0)
if (typeof n !== 'number' || n > 0)
state.emittedReadable = false;

@@ -401,3 +402,3 @@

if (util.isNull(ret)) {
if (ret === null) {
state.needReadable = true;

@@ -418,3 +419,3 @@ n = 0;

if (!util.isNull(ret))
if (ret !== null)
this.emit('data', ret);

@@ -427,5 +428,6 @@

var er = null;
if (!util.isBuffer(chunk) &&
!util.isString(chunk) &&
!util.isNullOrUndefined(chunk) &&
if (!(Buffer.isBuffer(chunk)) &&
typeof chunk !== 'string' &&
chunk !== null &&
chunk !== undefined &&
!state.objectMode) {

@@ -439,3 +441,4 @@ er = new TypeError('Invalid non-string/buffer chunk');

function onEofChunk(stream, state) {
if (state.decoder && !state.ended) {
if (state.ended) return;
if (state.decoder) {
var chunk = state.decoder.end();

@@ -463,5 +466,3 @@ if (chunk && chunk.length) {

if (state.sync)
process.nextTick(function() {
emitReadable_(stream);
});
processNextTick(emitReadable_, stream);
else

@@ -488,5 +489,3 @@ emitReadable_(stream);

state.readingMore = true;
process.nextTick(function() {
maybeReadMore_(stream, state);
});
processNextTick(maybeReadMore_, stream, state);
}

@@ -542,3 +541,3 @@ }

if (state.endEmitted)
process.nextTick(endFn);
processNextTick(endFn);
else

@@ -738,7 +737,3 @@ src.once('end', endFn);

if (!state.reading) {
var self = this;
process.nextTick(function() {
debug('readable nexttick read 0');
self.read(0);
});
processNextTick(nReadingNextTick, this);
} else if (state.length) {

@@ -754,2 +749,7 @@ emitReadable(this, state);

function nReadingNextTick(self) {
debug('readable nexttick read 0');
self.read(0);
}
// pause() and resume() are remnants of the legacy readable stream API

@@ -762,6 +762,2 @@ // If the user uses them, then switch into old mode.

state.flowing = true;
if (!state.reading) {
debug('resume read 0');
this.read(0);
}
resume(this, state);

@@ -775,5 +771,3 @@ }

state.resumeScheduled = true;
process.nextTick(function() {
resume_(stream, state);
});
processNextTick(resume_, stream, state);
}

@@ -783,2 +777,7 @@ }

function resume_(stream, state) {
if (!state.reading) {
debug('resume read 0');
stream.read(0);
}
state.resumeScheduled = false;

@@ -834,4 +833,8 @@ stream.emit('resume');

chunk = state.decoder.write(chunk);
if (!chunk || !state.objectMode && !chunk.length)
// don't skip over falsy values in objectMode
if (state.objectMode && (chunk === null || chunk === undefined))
return;
else if (!state.objectMode && (!chunk || !chunk.length))
return;

@@ -848,6 +851,6 @@ var ret = self.push(chunk);

for (var i in stream) {
if (util.isFunction(stream[i]) && util.isUndefined(this[i])) {
if (this[i] === undefined && typeof stream[i] === 'function') {
this[i] = function(method) { return function() {
return stream[method].apply(stream, arguments);
}}(i);
}; }(i);
}

@@ -956,13 +959,15 @@ }

state.ended = true;
process.nextTick(function() {
// Check that we didn't get one last unshift.
if (!state.endEmitted && state.length === 0) {
state.endEmitted = true;
stream.readable = false;
stream.emit('end');
}
});
processNextTick(endReadableNT, state, stream);
}
}
function endReadableNT(state, stream) {
// Check that we didn't get one last unshift.
if (!state.endEmitted && state.length === 0) {
state.endEmitted = true;
stream.readable = false;
stream.emit('end');
}
}
function forEach (xs, f) {

@@ -969,0 +974,0 @@ for (var i = 0, l = xs.length; i < l; i++) {

@@ -1,23 +0,1 @@

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// a transform stream is a readable/writable stream where you do

@@ -65,2 +43,4 @@ // something with the data. Sometimes it's called a "filter",

'use strict';
module.exports = Transform;

@@ -78,3 +58,3 @@

function TransformState(options, stream) {
function TransformState(stream) {
this.afterTransform = function(er, data) {

@@ -102,3 +82,3 @@ return afterTransform(stream, er, data);

if (!util.isNullOrUndefined(data))
if (data !== null && data !== undefined)
stream.push(data);

@@ -123,3 +103,3 @@

this._transformState = new TransformState(options, this);
this._transformState = new TransformState(this);

@@ -137,4 +117,12 @@ // when the writable side finishes, then flush out anything remaining.

if (options) {
if (typeof options.transform === 'function')
this._transform = options.transform;
if (typeof options.flush === 'function')
this._flush = options.flush;
}
this.once('prefinish', function() {
if (util.isFunction(this._flush))
if (typeof this._flush === 'function')
this._flush(function(er) {

@@ -187,3 +175,3 @@ done(stream, er);

if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) {
if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
ts.transforming = true;

@@ -190,0 +178,0 @@ this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);

@@ -1,22 +0,1 @@

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// A bit simpler than readable streams.

@@ -26,5 +5,12 @@ // Implement an async ._write(chunk, cb), and it'll handle all

'use strict';
module.exports = Writable;
/*<replacement>*/
var processNextTick = require('process-nextick-args');
/*</replacement>*/
/*<replacement>*/
var Buffer = require('buffer').Buffer;

@@ -41,6 +27,17 @@ /*</replacement>*/

var Stream = require('stream');
/*<replacement>*/
var Stream;
(function (){try{
Stream = require('st' + 'ream');
}catch(_){Stream = require('events').EventEmitter;}}())
/*</replacement>*/
var Buffer = require('buffer').Buffer;
util.inherits(Writable, Stream);
function nop() {}
function WriteReq(chunk, encoding, cb) {

@@ -50,2 +47,3 @@ this.chunk = chunk;

this.callback = cb;
this.next = null;
}

@@ -58,9 +56,2 @@

// the point at which write() starts returning false
// Note: 0 is a valid value, means that we always return false if
// the entire buffer is not flushed immediately on write()
var hwm = options.highWaterMark;
var defaultHwm = options.objectMode ? 16 : 16 * 1024;
this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
// object stream flag to indicate whether or not this stream

@@ -73,2 +64,9 @@ // contains buffers or objects.

// the point at which write() starts returning false
// Note: 0 is a valid value, means that we always return false if
// the entire buffer is not flushed immediately on write()
var hwm = options.highWaterMark;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
// cast to ints.

@@ -129,3 +127,4 @@ this.highWaterMark = ~~this.highWaterMark;

this.buffer = [];
this.bufferedRequest = null;
this.lastBufferedRequest = null;

@@ -144,2 +143,22 @@ // number of pending user-supplied write callbacks

WritableState.prototype.getBuffer = function writableStateGetBuffer() {
var current = this.bufferedRequest;
var out = [];
while (current) {
out.push(current);
current = current.next;
}
return out;
};
(function (){try {
Object.defineProperty(WritableState.prototype, 'buffer', {
get: require('util-deprecate')(function() {
return this.getBuffer();
}, '_writableState.buffer is deprecated. Use ' +
'_writableState.getBuffer() instead.')
});
}catch(_){}}());
function Writable(options) {

@@ -158,2 +177,10 @@ var Duplex = require('./_stream_duplex');

if (options) {
if (typeof options.write === 'function')
this._write = options.write;
if (typeof options.writev === 'function')
this._writev = options.writev;
}
Stream.call(this);

@@ -168,9 +195,7 @@ }

function writeAfterEnd(stream, state, cb) {
function writeAfterEnd(stream, cb) {
var er = new Error('write after end');
// TODO: defer error events consistently everywhere, not just the cb
stream.emit('error', er);
process.nextTick(function() {
cb(er);
});
processNextTick(cb, er);
}

@@ -185,11 +210,11 @@

var valid = true;
if (!util.isBuffer(chunk) &&
!util.isString(chunk) &&
!util.isNullOrUndefined(chunk) &&
if (!(Buffer.isBuffer(chunk)) &&
typeof chunk !== 'string' &&
chunk !== null &&
chunk !== undefined &&
!state.objectMode) {
var er = new TypeError('Invalid non-string/buffer chunk');
stream.emit('error', er);
process.nextTick(function() {
cb(er);
});
processNextTick(cb, er);
valid = false;

@@ -204,3 +229,3 @@ }

if (util.isFunction(encoding)) {
if (typeof encoding === 'function') {
cb = encoding;

@@ -210,3 +235,3 @@ encoding = null;

if (util.isBuffer(chunk))
if (Buffer.isBuffer(chunk))
encoding = 'buffer';

@@ -216,7 +241,7 @@ else if (!encoding)

if (!util.isFunction(cb))
cb = function() {};
if (typeof cb !== 'function')
cb = nop;
if (state.ended)
writeAfterEnd(this, state, cb);
writeAfterEnd(this, cb);
else if (validChunk(this, state, chunk, cb)) {

@@ -246,3 +271,3 @@ state.pendingcb++;

!state.bufferProcessing &&
state.buffer.length)
state.bufferedRequest)
clearBuffer(this, state);

@@ -252,6 +277,17 @@ }

Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
// node::ParseEncoding() requires lower case.
if (typeof encoding === 'string')
encoding = encoding.toLowerCase();
if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64',
'ucs2', 'ucs-2','utf16le', 'utf-16le', 'raw']
.indexOf((encoding + '').toLowerCase()) > -1))
throw new TypeError('Unknown encoding: ' + encoding);
this._writableState.defaultEncoding = encoding;
};
function decodeChunk(state, chunk, encoding) {
if (!state.objectMode &&
state.decodeStrings !== false &&
util.isString(chunk)) {
typeof chunk === 'string') {
chunk = new Buffer(chunk, encoding);

@@ -267,3 +303,4 @@ }

chunk = decodeChunk(state, chunk, encoding);
if (util.isBuffer(chunk))
if (Buffer.isBuffer(chunk))
encoding = 'buffer';

@@ -279,6 +316,13 @@ var len = state.objectMode ? 1 : chunk.length;

if (state.writing || state.corked)
state.buffer.push(new WriteReq(chunk, encoding, cb));
else
if (state.writing || state.corked) {
var last = state.lastBufferedRequest;
state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
if (last) {
last.next = state.lastBufferedRequest;
} else {
state.bufferedRequest = state.lastBufferedRequest;
}
} else {
doWrite(stream, state, false, len, chunk, encoding, cb);
}

@@ -301,11 +345,7 @@ return ret;

function onwriteError(stream, state, sync, er, cb) {
--state.pendingcb;
if (sync)
process.nextTick(function() {
state.pendingcb--;
cb(er);
});
else {
state.pendingcb--;
processNextTick(cb, er);
else
cb(er);
}

@@ -334,3 +374,3 @@ stream._writableState.errorEmitted = true;

// Check if we're actually ready to finish, but don't emit yet
var finished = needFinish(stream, state);
var finished = needFinish(state);

@@ -340,3 +380,3 @@ if (!finished &&

!state.bufferProcessing &&
state.buffer.length) {
state.bufferedRequest) {
clearBuffer(stream, state);

@@ -346,5 +386,3 @@ }

if (sync) {
process.nextTick(function() {
afterWrite(stream, state, finished, cb);
});
processNextTick(afterWrite, stream, state, finished, cb);
} else {

@@ -378,8 +416,13 @@ afterWrite(stream, state, finished, cb);

state.bufferProcessing = true;
var entry = state.bufferedRequest;
if (stream._writev && state.buffer.length > 1) {
if (stream._writev && entry && entry.next) {
// Fast case, write everything using _writev()
var buffer = [];
var cbs = [];
for (var c = 0; c < state.buffer.length; c++)
cbs.push(state.buffer[c].callback);
while (entry) {
cbs.push(entry.callback);
buffer.push(entry);
entry = entry.next;
}

@@ -389,3 +432,4 @@ // count the one we are adding, as well.

state.pendingcb++;
doWrite(stream, state, true, state.length, state.buffer, '', function(err) {
state.lastBufferedRequest = null;
doWrite(stream, state, true, state.length, buffer, '', function(err) {
for (var i = 0; i < cbs.length; i++) {

@@ -398,7 +442,5 @@ state.pendingcb--;

// Clear buffer
state.buffer = [];
} else {
// Slow case, write chunks one-by-one
for (var c = 0; c < state.buffer.length; c++) {
var entry = state.buffer[c];
while (entry) {
var chunk = entry.chunk;

@@ -410,3 +452,3 @@ var encoding = entry.encoding;

doWrite(stream, state, false, len, chunk, encoding, cb);
entry = entry.next;
// if we didn't call the onwrite immediately, then

@@ -417,3 +459,2 @@ // it means that we need to wait until it does.

if (state.writing) {
c++;
break;

@@ -423,8 +464,6 @@ }

if (c < state.buffer.length)
state.buffer = state.buffer.slice(c);
else
state.buffer.length = 0;
if (entry === null)
state.lastBufferedRequest = null;
}
state.bufferedRequest = entry;
state.bufferProcessing = false;

@@ -435,3 +474,2 @@ }

cb(new Error('not implemented'));
};

@@ -444,7 +482,7 @@

if (util.isFunction(chunk)) {
if (typeof chunk === 'function') {
cb = chunk;
chunk = null;
encoding = null;
} else if (util.isFunction(encoding)) {
} else if (typeof encoding === 'function') {
cb = encoding;

@@ -454,3 +492,3 @@ encoding = null;

if (!util.isNullOrUndefined(chunk))
if (chunk !== null && chunk !== undefined)
this.write(chunk, encoding);

@@ -470,5 +508,6 @@

function needFinish(stream, state) {
function needFinish(state) {
return (state.ending &&
state.length === 0 &&
state.bufferedRequest === null &&
!state.finished &&

@@ -486,3 +525,3 @@ !state.writing);

function finishMaybe(stream, state) {
var need = needFinish(stream, state);
var need = needFinish(state);
if (need) {

@@ -493,4 +532,5 @@ if (state.pendingcb === 0) {

stream.emit('finish');
} else
} else {
prefinish(stream, state);
}
}

@@ -505,3 +545,3 @@ return need;

if (state.finished)
process.nextTick(cb);
processNextTick(cb);
else

@@ -508,0 +548,0 @@ stream.once('finish', cb);

@@ -8,3 +8,3 @@ {

"type": "git",
"url": "git://github.com/isaacs/core-util-is"
"url": "git://github.com/isaacs/core-util-is.git"
},

@@ -11,0 +11,0 @@ "keywords": [

@@ -19,3 +19,3 @@ {

"type": "git",
"url": "git://github.com/isaacs/inherits"
"url": "git://github.com/isaacs/inherits.git"
},

@@ -22,0 +22,0 @@ "license": "ISC",

{
"name": "readable-stream",
"version": "1.1.13",
"description": "Streams3, a user-land copy of the stream library from Node.js v0.11.x",
"version": "2.0.1",
"description": "Streams3, a user-land copy of the stream library from iojs v2.x",
"main": "readable.js",
"dependencies": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"process-nextick-args": "~1.0.0",
"string_decoder": "~0.10.x",
"inherits": "~2.0.1"
"util-deprecate": "~1.0.1"
},
"devDependencies": {
"tap": "~0.2.6"
"tap": "~0.2.6",
"tape": "~4.0.0",
"zuul": "~3.0.0"
},
"scripts": {
"test": "tap test/simple/*.js"
"test": "tap test/parallel/*.js",
"browser": "zuul --browser-name $BROWSER_NAME --browser-version $BROWSER_VERSION -- test/browser.js"
},
"repository": {
"type": "git",
"url": "git://github.com/isaacs/readable-stream"
"url": "git://github.com/nodejs/readable-stream.git"
},

@@ -30,25 +35,25 @@ "keywords": [

},
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"license": "MIT",
"gitHead": "3b672fd7ae92acf5b4ffdbabf74b372a0a56b051",
"gitHead": "d175d0f68745a5014fc9c41b25b8e0e959269126",
"bugs": {
"url": "https://github.com/isaacs/readable-stream/issues"
"url": "https://github.com/nodejs/readable-stream/issues"
},
"homepage": "https://github.com/isaacs/readable-stream",
"_id": "readable-stream@1.1.13",
"_shasum": "f6eef764f514c89e2b9e23146a75ba106756d23e",
"_from": "readable-stream@>=1.1.13 <1.2.0",
"_npmVersion": "1.4.23",
"homepage": "https://github.com/nodejs/readable-stream#readme",
"_id": "readable-stream@2.0.1",
"_shasum": "633479b7bd2fbe7a1e869825b40a0b333b9f2bfc",
"_from": "readable-stream@>=2.0.0 <3.0.0",
"_npmVersion": "2.11.1",
"_nodeVersion": "2.3.0",
"_npmUser": {
"name": "rvagg",
"email": "rod@vagg.org"
"name": "cwmma",
"email": "calvin.metcalf@gmail.com"
},
"dist": {
"shasum": "633479b7bd2fbe7a1e869825b40a0b333b9f2bfc",
"tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.0.1.tgz"
},
"maintainers": [
{
"name": "isaacs",
"email": "i@izs.me"
"email": "isaacs@npmjs.com"
},

@@ -62,11 +67,11 @@ {

"email": "rod@vagg.org"
},
{
"name": "cwmma",
"email": "calvin.metcalf@gmail.com"
}
],
"dist": {
"shasum": "f6eef764f514c89e2b9e23146a75ba106756d23e",
"tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz",
"_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.1.tgz",
"readme": "ERROR: No README data found!"
}

@@ -0,3 +1,8 @@

var Stream = (function (){
try {
return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify
} catch(_){}
}());
exports = module.exports = require('./lib/_stream_readable.js');
exports.Stream = require('stream');
exports.Stream = Stream || exports;
exports.Readable = exports;

@@ -4,0 +9,0 @@ exports.Writable = require('./lib/_stream_writable.js');

# readable-stream
***Node-core streams for userland***
***Node-core streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream)
[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/)
[![NPM](https://nodei.co/npm-dl/readable-stream.png&months=6&height=3)](https://nodei.co/npm/readable-stream/)
[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/)
This package is a mirror of the Streams2 and Streams3 implementations in Node-core.
If you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core.
[![Sauce Test Status](https://saucelabs.com/browser-matrix/readable-stream.svg)](https://saucelabs.com/u/readable-stream)
**readable-stream** comes in two major versions, v1.0.x and v1.1.x. The former tracks the Streams2 implementation in Node 0.10, including bug-fixes and minor improvements as they are added. The latter tracks Streams3 as it develops in Node 0.11; we will likely see a v1.2.x branch for Node 0.12.
```bash
npm install --save readable-stream
```
**readable-stream** uses proper patch-level versioning so if you pin to `"~1.0.0"` you’ll get the latest Node 0.10 Streams2 implementation, including any fixes and minor non-breaking improvements. The patch-level versions of 1.0.x and 1.1.x should mirror the patch-level versions of Node-core releases. You should prefer the **1.0.x** releases for now and when you’re ready to start using Streams3, pin to `"~1.1.0"`
***Node-core streams for userland***
This package is a mirror of the Streams2 and Streams3 implementations in
Node-core, including [documentation](doc/stream.markdown).
If you want to guarantee a stable streams base, regardless of what version of
Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).
As of version 2.0.0 **readable-stream** uses semantic versioning.
# Streams WG Team Members
* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) &lt;christopher.s.dickinson@gmail.com&gt;
- Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B
* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) &lt;calvin.metcalf@gmail.com&gt;
- Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242
* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) &lt;rod@vagg.org&gt;
- Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D
* **Sam Newman** ([@sonewman](https://github.com/sonewman)) &lt;newmansam@outlook.com&gt;
* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) &lt;mathiasbuus@gmail.com&gt;
* **Domenic Denicola** ([@domenic](https://github.com/domenic)) &lt;d@domenic.me&gt;
{
"name": "duplexify",
"version": "3.4.1",
"version": "3.4.2",
"description": "Turn a writeable and readable stream into a streams2 duplex stream with support for async initialization and streams1/streams2 input",

@@ -8,3 +8,3 @@ "main": "index.js",

"end-of-stream": "1.0.0",
"readable-stream": "^1.1.13"
"readable-stream": "^2.0.0"
},

@@ -40,8 +40,8 @@ "devDependencies": {

"homepage": "https://github.com/mafintosh/duplexify",
"gitHead": "2be4a0dab319d4185e2cc92614b9453dfddc5889",
"_id": "duplexify@3.4.1",
"_shasum": "eb0e8a2040e27e2db9ff8d8d36d3a1b4427fc502",
"gitHead": "ba1aed77e6f36adcac0ca01d750f2cc5baa9ff1c",
"_id": "duplexify@3.4.2",
"_shasum": "71a578af03e0d063eb8f1326affd5e5600145e1b",
"_from": "duplexify@>=3.2.0 <4.0.0",
"_npmVersion": "2.10.1",
"_nodeVersion": "2.1.0",
"_npmVersion": "2.11.0",
"_nodeVersion": "2.2.1",
"_npmUser": {

@@ -52,4 +52,4 @@ "name": "mafintosh",

"dist": {
"shasum": "eb0e8a2040e27e2db9ff8d8d36d3a1b4427fc502",
"tarball": "http://npm.zombielair.com:4873/duplexify/-/duplexify-3.4.1.tgz"
"shasum": "71a578af03e0d063eb8f1326affd5e5600145e1b",
"tarball": "http://registry.npmjs.org/duplexify/-/duplexify-3.4.2.tgz"
},

@@ -63,4 +63,3 @@ "maintainers": [

"directories": {},
"_resolved": "http://npm.zombielair.com:4873/duplexify/-/duplexify-3.4.1.tgz",
"readme": "ERROR: No README data found!"
"_resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.4.2.tgz"
}

@@ -10,3 +10,3 @@ {

"type": "git",
"url": "https://github.com/floatdrop/infinity-agent"
"url": "git+https://github.com/floatdrop/infinity-agent.git"
},

@@ -13,0 +13,0 @@ "keywords": [

@@ -8,3 +8,3 @@ {

"type": "git",
"url": "https://github.com/sindresorhus/is-stream"
"url": "git+https://github.com/sindresorhus/is-stream.git"
},

@@ -11,0 +11,0 @@ "author": {

@@ -8,3 +8,3 @@ {

"type": "git",
"url": "https://github.com/sindresorhus/lowercase-keys"
"url": "git+https://github.com/sindresorhus/lowercase-keys.git"
},

@@ -11,0 +11,0 @@ "author": {

@@ -15,3 +15,3 @@ {

"type": "git",
"url": "https://github.com/mdlavin/nested-error-stacks.git"
"url": "git+https://github.com/mdlavin/nested-error-stacks.git"
},

@@ -18,0 +18,0 @@ "main": "index.js",

@@ -8,3 +8,3 @@ {

"type": "git",
"url": "https://github.com/sindresorhus/object-assign"
"url": "git+https://github.com/sindresorhus/object-assign.git"
},

@@ -11,0 +11,0 @@ "author": {

@@ -8,3 +8,3 @@ {

"type": "git",
"url": "https://github.com/sindresorhus/prepend-http"
"url": "git+https://github.com/sindresorhus/prepend-http.git"
},

@@ -11,0 +11,0 @@ "author": {

@@ -1,22 +0,1 @@

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// a duplex stream is just a stream that is both readable and writable.

@@ -27,3 +6,3 @@ // Since JS doesn't have multiple prototypal inheritance, this class

module.exports = Duplex;
'use strict';

@@ -39,3 +18,11 @@ /*<replacement>*/

module.exports = Duplex;
/*<replacement>*/
var processNextTick = require('process-nextick-args');
/*</replacement>*/
/*<replacement>*/
var util = require('core-util-is');

@@ -50,6 +37,8 @@ util.inherits = require('inherits');

forEach(objectKeys(Writable.prototype), function(method) {
var keys = objectKeys(Writable.prototype);
for (var v = 0; v < keys.length; v++) {
var method = keys[v];
if (!Duplex.prototype[method])
Duplex.prototype[method] = Writable.prototype[method];
});
}

@@ -85,5 +74,9 @@ function Duplex(options) {

// But allow more writes to happen in this tick.
process.nextTick(this.end.bind(this));
processNextTick(onEndNT, this);
}
function onEndNT(self) {
self.end();
}
function forEach (xs, f) {

@@ -90,0 +83,0 @@ for (var i = 0, l = xs.length; i < l; i++) {

@@ -1,22 +0,1 @@

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// a passthrough stream.

@@ -26,2 +5,4 @@ // basically just the most minimal sort of Transform stream.

'use strict';
module.exports = PassThrough;

@@ -28,0 +9,0 @@

@@ -1,21 +0,2 @@

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';

@@ -25,2 +6,7 @@ module.exports = Readable;

/*<replacement>*/
var processNextTick = require('process-nextick-args');
/*</replacement>*/
/*<replacement>*/
var isArray = require('isarray');

@@ -44,5 +30,14 @@ /*</replacement>*/

var Stream = require('stream');
/*<replacement>*/
var Stream;
(function (){try{
Stream = require('st' + 'ream');
}catch(_){Stream = require('events').EventEmitter;}}())
/*</replacement>*/
var Buffer = require('buffer').Buffer;
/*<replacement>*/
var util = require('core-util-is');

@@ -52,3 +47,2 @@ util.inherits = require('inherits');

var StringDecoder;

@@ -65,2 +59,3 @@

var StringDecoder;

@@ -74,6 +69,13 @@ util.inherits(Readable, Stream);

// object stream flag. Used to make read(n) ignore n and to
// make all the buffer merging and length checks go away
this.objectMode = !!options.objectMode;
if (stream instanceof Duplex)
this.objectMode = this.objectMode || !!options.readableObjectMode;
// the point at which it stops calling _read() to fill the buffer
// Note: 0 is a valid value, means "don't call _read preemptively ever"
var hwm = options.highWaterMark;
var defaultHwm = options.objectMode ? 16 : 16 * 1024;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;

@@ -105,10 +107,2 @@

// object stream flag. Used to make read(n) ignore n and to
// make all the buffer merging and length checks go away
this.objectMode = !!options.objectMode;
if (stream instanceof Duplex)
this.objectMode = this.objectMode || !!options.readableObjectMode;
// Crypto is kind of old and crusty. Historically, its default string

@@ -150,2 +144,5 @@ // encoding is 'binary' so we have to make this configurable.

if (options && typeof options.read === 'function')
this._read = options.read;
Stream.call(this);

@@ -161,3 +158,3 @@ }

if (util.isString(chunk) && !state.objectMode) {
if (!state.objectMode && typeof chunk === 'string') {
encoding = encoding || state.defaultEncoding;

@@ -179,2 +176,6 @@ if (encoding !== state.encoding) {

Readable.prototype.isPaused = function() {
return this._readableState.flowing === false;
};
function readableAddChunk(stream, state, chunk, encoding, addToFront) {

@@ -184,6 +185,5 @@ var er = chunkInvalid(state, chunk);

stream.emit('error', er);
} else if (util.isNullOrUndefined(chunk)) {
} else if (chunk === null) {
state.reading = false;
if (!state.ended)
onEofChunk(stream, state);
onEofChunk(stream, state);
} else if (state.objectMode || chunk && chunk.length > 0) {

@@ -274,3 +274,3 @@ if (state.ended && !addToFront) {

if (isNaN(n) || util.isNull(n)) {
if (n === null || isNaN(n)) {
// only flow one buffer at a time

@@ -298,4 +298,5 @@ if (state.flowing && state.buffer.length)

return 0;
} else
} else {
return state.length;
}
}

@@ -312,3 +313,3 @@

if (!util.isNumber(n) || n > 0)
if (typeof n !== 'number' || n > 0)
state.emittedReadable = false;

@@ -401,3 +402,3 @@

if (util.isNull(ret)) {
if (ret === null) {
state.needReadable = true;

@@ -418,3 +419,3 @@ n = 0;

if (!util.isNull(ret))
if (ret !== null)
this.emit('data', ret);

@@ -427,5 +428,6 @@

var er = null;
if (!util.isBuffer(chunk) &&
!util.isString(chunk) &&
!util.isNullOrUndefined(chunk) &&
if (!(Buffer.isBuffer(chunk)) &&
typeof chunk !== 'string' &&
chunk !== null &&
chunk !== undefined &&
!state.objectMode) {

@@ -439,3 +441,4 @@ er = new TypeError('Invalid non-string/buffer chunk');

function onEofChunk(stream, state) {
if (state.decoder && !state.ended) {
if (state.ended) return;
if (state.decoder) {
var chunk = state.decoder.end();

@@ -463,5 +466,3 @@ if (chunk && chunk.length) {

if (state.sync)
process.nextTick(function() {
emitReadable_(stream);
});
processNextTick(emitReadable_, stream);
else

@@ -488,5 +489,3 @@ emitReadable_(stream);

state.readingMore = true;
process.nextTick(function() {
maybeReadMore_(stream, state);
});
processNextTick(maybeReadMore_, stream, state);
}

@@ -542,3 +541,3 @@ }

if (state.endEmitted)
process.nextTick(endFn);
processNextTick(endFn);
else

@@ -738,7 +737,3 @@ src.once('end', endFn);

if (!state.reading) {
var self = this;
process.nextTick(function() {
debug('readable nexttick read 0');
self.read(0);
});
processNextTick(nReadingNextTick, this);
} else if (state.length) {

@@ -754,2 +749,7 @@ emitReadable(this, state);

function nReadingNextTick(self) {
debug('readable nexttick read 0');
self.read(0);
}
// pause() and resume() are remnants of the legacy readable stream API

@@ -762,6 +762,2 @@ // If the user uses them, then switch into old mode.

state.flowing = true;
if (!state.reading) {
debug('resume read 0');
this.read(0);
}
resume(this, state);

@@ -775,5 +771,3 @@ }

state.resumeScheduled = true;
process.nextTick(function() {
resume_(stream, state);
});
processNextTick(resume_, stream, state);
}

@@ -783,2 +777,7 @@ }

function resume_(stream, state) {
if (!state.reading) {
debug('resume read 0');
stream.read(0);
}
state.resumeScheduled = false;

@@ -834,4 +833,8 @@ stream.emit('resume');

chunk = state.decoder.write(chunk);
if (!chunk || !state.objectMode && !chunk.length)
// don't skip over falsy values in objectMode
if (state.objectMode && (chunk === null || chunk === undefined))
return;
else if (!state.objectMode && (!chunk || !chunk.length))
return;

@@ -848,6 +851,6 @@ var ret = self.push(chunk);

for (var i in stream) {
if (util.isFunction(stream[i]) && util.isUndefined(this[i])) {
if (this[i] === undefined && typeof stream[i] === 'function') {
this[i] = function(method) { return function() {
return stream[method].apply(stream, arguments);
}}(i);
}; }(i);
}

@@ -956,13 +959,15 @@ }

state.ended = true;
process.nextTick(function() {
// Check that we didn't get one last unshift.
if (!state.endEmitted && state.length === 0) {
state.endEmitted = true;
stream.readable = false;
stream.emit('end');
}
});
processNextTick(endReadableNT, state, stream);
}
}
function endReadableNT(state, stream) {
// Check that we didn't get one last unshift.
if (!state.endEmitted && state.length === 0) {
state.endEmitted = true;
stream.readable = false;
stream.emit('end');
}
}
function forEach (xs, f) {

@@ -969,0 +974,0 @@ for (var i = 0, l = xs.length; i < l; i++) {

@@ -1,23 +0,1 @@

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// a transform stream is a readable/writable stream where you do

@@ -65,2 +43,4 @@ // something with the data. Sometimes it's called a "filter",

'use strict';
module.exports = Transform;

@@ -78,3 +58,3 @@

function TransformState(options, stream) {
function TransformState(stream) {
this.afterTransform = function(er, data) {

@@ -102,3 +82,3 @@ return afterTransform(stream, er, data);

if (!util.isNullOrUndefined(data))
if (data !== null && data !== undefined)
stream.push(data);

@@ -123,3 +103,3 @@

this._transformState = new TransformState(options, this);
this._transformState = new TransformState(this);

@@ -137,4 +117,12 @@ // when the writable side finishes, then flush out anything remaining.

if (options) {
if (typeof options.transform === 'function')
this._transform = options.transform;
if (typeof options.flush === 'function')
this._flush = options.flush;
}
this.once('prefinish', function() {
if (util.isFunction(this._flush))
if (typeof this._flush === 'function')
this._flush(function(er) {

@@ -187,3 +175,3 @@ done(stream, er);

if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) {
if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
ts.transforming = true;

@@ -190,0 +178,0 @@ this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);

@@ -1,22 +0,1 @@

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// A bit simpler than readable streams.

@@ -26,5 +5,12 @@ // Implement an async ._write(chunk, cb), and it'll handle all

'use strict';
module.exports = Writable;
/*<replacement>*/
var processNextTick = require('process-nextick-args');
/*</replacement>*/
/*<replacement>*/
var Buffer = require('buffer').Buffer;

@@ -41,6 +27,17 @@ /*</replacement>*/

var Stream = require('stream');
/*<replacement>*/
var Stream;
(function (){try{
Stream = require('st' + 'ream');
}catch(_){Stream = require('events').EventEmitter;}}())
/*</replacement>*/
var Buffer = require('buffer').Buffer;
util.inherits(Writable, Stream);
function nop() {}
function WriteReq(chunk, encoding, cb) {

@@ -50,2 +47,3 @@ this.chunk = chunk;

this.callback = cb;
this.next = null;
}

@@ -58,9 +56,2 @@

// the point at which write() starts returning false
// Note: 0 is a valid value, means that we always return false if
// the entire buffer is not flushed immediately on write()
var hwm = options.highWaterMark;
var defaultHwm = options.objectMode ? 16 : 16 * 1024;
this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
// object stream flag to indicate whether or not this stream

@@ -73,2 +64,9 @@ // contains buffers or objects.

// the point at which write() starts returning false
// Note: 0 is a valid value, means that we always return false if
// the entire buffer is not flushed immediately on write()
var hwm = options.highWaterMark;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
// cast to ints.

@@ -129,3 +127,4 @@ this.highWaterMark = ~~this.highWaterMark;

this.buffer = [];
this.bufferedRequest = null;
this.lastBufferedRequest = null;

@@ -144,2 +143,22 @@ // number of pending user-supplied write callbacks

WritableState.prototype.getBuffer = function writableStateGetBuffer() {
var current = this.bufferedRequest;
var out = [];
while (current) {
out.push(current);
current = current.next;
}
return out;
};
(function (){try {
Object.defineProperty(WritableState.prototype, 'buffer', {
get: require('util-deprecate')(function() {
return this.getBuffer();
}, '_writableState.buffer is deprecated. Use ' +
'_writableState.getBuffer() instead.')
});
}catch(_){}}());
function Writable(options) {

@@ -158,2 +177,10 @@ var Duplex = require('./_stream_duplex');

if (options) {
if (typeof options.write === 'function')
this._write = options.write;
if (typeof options.writev === 'function')
this._writev = options.writev;
}
Stream.call(this);

@@ -168,9 +195,7 @@ }

function writeAfterEnd(stream, state, cb) {
function writeAfterEnd(stream, cb) {
var er = new Error('write after end');
// TODO: defer error events consistently everywhere, not just the cb
stream.emit('error', er);
process.nextTick(function() {
cb(er);
});
processNextTick(cb, er);
}

@@ -185,11 +210,11 @@

var valid = true;
if (!util.isBuffer(chunk) &&
!util.isString(chunk) &&
!util.isNullOrUndefined(chunk) &&
if (!(Buffer.isBuffer(chunk)) &&
typeof chunk !== 'string' &&
chunk !== null &&
chunk !== undefined &&
!state.objectMode) {
var er = new TypeError('Invalid non-string/buffer chunk');
stream.emit('error', er);
process.nextTick(function() {
cb(er);
});
processNextTick(cb, er);
valid = false;

@@ -204,3 +229,3 @@ }

if (util.isFunction(encoding)) {
if (typeof encoding === 'function') {
cb = encoding;

@@ -210,3 +235,3 @@ encoding = null;

if (util.isBuffer(chunk))
if (Buffer.isBuffer(chunk))
encoding = 'buffer';

@@ -216,7 +241,7 @@ else if (!encoding)

if (!util.isFunction(cb))
cb = function() {};
if (typeof cb !== 'function')
cb = nop;
if (state.ended)
writeAfterEnd(this, state, cb);
writeAfterEnd(this, cb);
else if (validChunk(this, state, chunk, cb)) {

@@ -246,3 +271,3 @@ state.pendingcb++;

!state.bufferProcessing &&
state.buffer.length)
state.bufferedRequest)
clearBuffer(this, state);

@@ -252,6 +277,17 @@ }

Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
// node::ParseEncoding() requires lower case.
if (typeof encoding === 'string')
encoding = encoding.toLowerCase();
if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64',
'ucs2', 'ucs-2','utf16le', 'utf-16le', 'raw']
.indexOf((encoding + '').toLowerCase()) > -1))
throw new TypeError('Unknown encoding: ' + encoding);
this._writableState.defaultEncoding = encoding;
};
function decodeChunk(state, chunk, encoding) {
if (!state.objectMode &&
state.decodeStrings !== false &&
util.isString(chunk)) {
typeof chunk === 'string') {
chunk = new Buffer(chunk, encoding);

@@ -267,3 +303,4 @@ }

chunk = decodeChunk(state, chunk, encoding);
if (util.isBuffer(chunk))
if (Buffer.isBuffer(chunk))
encoding = 'buffer';

@@ -279,6 +316,13 @@ var len = state.objectMode ? 1 : chunk.length;

if (state.writing || state.corked)
state.buffer.push(new WriteReq(chunk, encoding, cb));
else
if (state.writing || state.corked) {
var last = state.lastBufferedRequest;
state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
if (last) {
last.next = state.lastBufferedRequest;
} else {
state.bufferedRequest = state.lastBufferedRequest;
}
} else {
doWrite(stream, state, false, len, chunk, encoding, cb);
}

@@ -301,11 +345,7 @@ return ret;

function onwriteError(stream, state, sync, er, cb) {
--state.pendingcb;
if (sync)
process.nextTick(function() {
state.pendingcb--;
cb(er);
});
else {
state.pendingcb--;
processNextTick(cb, er);
else
cb(er);
}

@@ -334,3 +374,3 @@ stream._writableState.errorEmitted = true;

// Check if we're actually ready to finish, but don't emit yet
var finished = needFinish(stream, state);
var finished = needFinish(state);

@@ -340,3 +380,3 @@ if (!finished &&

!state.bufferProcessing &&
state.buffer.length) {
state.bufferedRequest) {
clearBuffer(stream, state);

@@ -346,5 +386,3 @@ }

if (sync) {
process.nextTick(function() {
afterWrite(stream, state, finished, cb);
});
processNextTick(afterWrite, stream, state, finished, cb);
} else {

@@ -378,8 +416,13 @@ afterWrite(stream, state, finished, cb);

state.bufferProcessing = true;
var entry = state.bufferedRequest;
if (stream._writev && state.buffer.length > 1) {
if (stream._writev && entry && entry.next) {
// Fast case, write everything using _writev()
var buffer = [];
var cbs = [];
for (var c = 0; c < state.buffer.length; c++)
cbs.push(state.buffer[c].callback);
while (entry) {
cbs.push(entry.callback);
buffer.push(entry);
entry = entry.next;
}

@@ -389,3 +432,4 @@ // count the one we are adding, as well.

state.pendingcb++;
doWrite(stream, state, true, state.length, state.buffer, '', function(err) {
state.lastBufferedRequest = null;
doWrite(stream, state, true, state.length, buffer, '', function(err) {
for (var i = 0; i < cbs.length; i++) {

@@ -398,7 +442,5 @@ state.pendingcb--;

// Clear buffer
state.buffer = [];
} else {
// Slow case, write chunks one-by-one
for (var c = 0; c < state.buffer.length; c++) {
var entry = state.buffer[c];
while (entry) {
var chunk = entry.chunk;

@@ -410,3 +452,3 @@ var encoding = entry.encoding;

doWrite(stream, state, false, len, chunk, encoding, cb);
entry = entry.next;
// if we didn't call the onwrite immediately, then

@@ -417,3 +459,2 @@ // it means that we need to wait until it does.

if (state.writing) {
c++;
break;

@@ -423,8 +464,6 @@ }

if (c < state.buffer.length)
state.buffer = state.buffer.slice(c);
else
state.buffer.length = 0;
if (entry === null)
state.lastBufferedRequest = null;
}
state.bufferedRequest = entry;
state.bufferProcessing = false;

@@ -435,3 +474,2 @@ }

cb(new Error('not implemented'));
};

@@ -444,7 +482,7 @@

if (util.isFunction(chunk)) {
if (typeof chunk === 'function') {
cb = chunk;
chunk = null;
encoding = null;
} else if (util.isFunction(encoding)) {
} else if (typeof encoding === 'function') {
cb = encoding;

@@ -454,3 +492,3 @@ encoding = null;

if (!util.isNullOrUndefined(chunk))
if (chunk !== null && chunk !== undefined)
this.write(chunk, encoding);

@@ -470,5 +508,6 @@

function needFinish(stream, state) {
function needFinish(state) {
return (state.ending &&
state.length === 0 &&
state.bufferedRequest === null &&
!state.finished &&

@@ -486,3 +525,3 @@ !state.writing);

function finishMaybe(stream, state) {
var need = needFinish(stream, state);
var need = needFinish(state);
if (need) {

@@ -493,4 +532,5 @@ if (state.pendingcb === 0) {

stream.emit('finish');
} else
} else {
prefinish(stream, state);
}
}

@@ -505,3 +545,3 @@ return need;

if (state.finished)
process.nextTick(cb);
processNextTick(cb);
else

@@ -508,0 +548,0 @@ stream.once('finish', cb);

@@ -8,3 +8,3 @@ {

"type": "git",
"url": "git://github.com/isaacs/core-util-is"
"url": "git://github.com/isaacs/core-util-is.git"
},

@@ -11,0 +11,0 @@ "keywords": [

@@ -19,3 +19,3 @@ {

"type": "git",
"url": "git://github.com/isaacs/inherits"
"url": "git://github.com/isaacs/inherits.git"
},

@@ -22,0 +22,0 @@ "license": "ISC",

{
"name": "readable-stream",
"version": "1.1.13",
"description": "Streams3, a user-land copy of the stream library from Node.js v0.11.x",
"version": "2.0.1",
"description": "Streams3, a user-land copy of the stream library from iojs v2.x",
"main": "readable.js",
"dependencies": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"process-nextick-args": "~1.0.0",
"string_decoder": "~0.10.x",
"inherits": "~2.0.1"
"util-deprecate": "~1.0.1"
},
"devDependencies": {
"tap": "~0.2.6"
"tap": "~0.2.6",
"tape": "~4.0.0",
"zuul": "~3.0.0"
},
"scripts": {
"test": "tap test/simple/*.js"
"test": "tap test/parallel/*.js",
"browser": "zuul --browser-name $BROWSER_NAME --browser-version $BROWSER_VERSION -- test/browser.js"
},
"repository": {
"type": "git",
"url": "git://github.com/isaacs/readable-stream"
"url": "git://github.com/nodejs/readable-stream.git"
},

@@ -30,25 +35,25 @@ "keywords": [

},
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"license": "MIT",
"gitHead": "3b672fd7ae92acf5b4ffdbabf74b372a0a56b051",
"gitHead": "d175d0f68745a5014fc9c41b25b8e0e959269126",
"bugs": {
"url": "https://github.com/isaacs/readable-stream/issues"
"url": "https://github.com/nodejs/readable-stream/issues"
},
"homepage": "https://github.com/isaacs/readable-stream",
"_id": "readable-stream@1.1.13",
"_shasum": "f6eef764f514c89e2b9e23146a75ba106756d23e",
"_from": "readable-stream@>=1.1.13 <1.2.0",
"_npmVersion": "1.4.23",
"homepage": "https://github.com/nodejs/readable-stream#readme",
"_id": "readable-stream@2.0.1",
"_shasum": "633479b7bd2fbe7a1e869825b40a0b333b9f2bfc",
"_from": "readable-stream@>=2.0.0 <3.0.0",
"_npmVersion": "2.11.1",
"_nodeVersion": "2.3.0",
"_npmUser": {
"name": "rvagg",
"email": "rod@vagg.org"
"name": "cwmma",
"email": "calvin.metcalf@gmail.com"
},
"dist": {
"shasum": "633479b7bd2fbe7a1e869825b40a0b333b9f2bfc",
"tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.0.1.tgz"
},
"maintainers": [
{
"name": "isaacs",
"email": "i@izs.me"
"email": "isaacs@npmjs.com"
},

@@ -62,11 +67,11 @@ {

"email": "rod@vagg.org"
},
{
"name": "cwmma",
"email": "calvin.metcalf@gmail.com"
}
],
"dist": {
"shasum": "f6eef764f514c89e2b9e23146a75ba106756d23e",
"tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz",
"_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.1.tgz",
"readme": "ERROR: No README data found!"
}

@@ -0,3 +1,8 @@

var Stream = (function (){
try {
return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify
} catch(_){}
}());
exports = module.exports = require('./lib/_stream_readable.js');
exports.Stream = require('stream');
exports.Stream = Stream || exports;
exports.Readable = exports;

@@ -4,0 +9,0 @@ exports.Writable = require('./lib/_stream_writable.js');

# readable-stream
***Node-core streams for userland***
***Node-core streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream)
[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/)
[![NPM](https://nodei.co/npm-dl/readable-stream.png&months=6&height=3)](https://nodei.co/npm/readable-stream/)
[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/)
This package is a mirror of the Streams2 and Streams3 implementations in Node-core.
If you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core.
[![Sauce Test Status](https://saucelabs.com/browser-matrix/readable-stream.svg)](https://saucelabs.com/u/readable-stream)
**readable-stream** comes in two major versions, v1.0.x and v1.1.x. The former tracks the Streams2 implementation in Node 0.10, including bug-fixes and minor improvements as they are added. The latter tracks Streams3 as it develops in Node 0.11; we will likely see a v1.2.x branch for Node 0.12.
```bash
npm install --save readable-stream
```
**readable-stream** uses proper patch-level versioning so if you pin to `"~1.0.0"` you’ll get the latest Node 0.10 Streams2 implementation, including any fixes and minor non-breaking improvements. The patch-level versions of 1.0.x and 1.1.x should mirror the patch-level versions of Node-core releases. You should prefer the **1.0.x** releases for now and when you’re ready to start using Streams3, pin to `"~1.1.0"`
***Node-core streams for userland***
This package is a mirror of the Streams2 and Streams3 implementations in
Node-core, including [documentation](doc/stream.markdown).
If you want to guarantee a stable streams base, regardless of what version of
Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).
As of version 2.0.0 **readable-stream** uses semantic versioning.
# Streams WG Team Members
* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) &lt;christopher.s.dickinson@gmail.com&gt;
- Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B
* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) &lt;calvin.metcalf@gmail.com&gt;
- Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242
* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) &lt;rod@vagg.org&gt;
- Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D
* **Sam Newman** ([@sonewman](https://github.com/sonewman)) &lt;newmansam@outlook.com&gt;
* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) &lt;mathiasbuus@gmail.com&gt;
* **Domenic Denicola** ([@domenic](https://github.com/domenic)) &lt;d@domenic.me&gt;
{
"name": "read-all-stream",
"version": "2.1.2",
"version": "2.2.0",
"description": "Read all stream content and pass it to callback",

@@ -33,5 +33,5 @@ "license": "MIT",

"dependencies": {
"readable-stream": "~1.1.13"
"readable-stream": "^2.0.0"
},
"gitHead": "fd1ff63dc2b55a249dbfeb32fa79526abb3b83de",
"gitHead": "7f687315d2ff8081a87735f9c7fcc33be041142e",
"bugs": {

@@ -41,6 +41,7 @@ "url": "https://github.com/floatdrop/read-all-stream/issues"

"homepage": "https://github.com/floatdrop/read-all-stream",
"_id": "read-all-stream@2.1.2",
"_shasum": "0e80070eadd99712383e9f3c26762310900bda0a",
"_id": "read-all-stream@2.2.0",
"_shasum": "6b83370546c55ab6ade2bf75e83c66e45989bbf0",
"_from": "read-all-stream@>=2.0.0 <3.0.0",
"_npmVersion": "1.4.28",
"_npmVersion": "2.11.1",
"_nodeVersion": "2.3.0",
"_npmUser": {

@@ -50,2 +51,6 @@ "name": "floatdrop",

},
"dist": {
"shasum": "6b83370546c55ab6ade2bf75e83c66e45989bbf0",
"tarball": "http://registry.npmjs.org/read-all-stream/-/read-all-stream-2.2.0.tgz"
},
"maintainers": [

@@ -57,9 +62,4 @@ {

],
"dist": {
"shasum": "0e80070eadd99712383e9f3c26762310900bda0a",
"tarball": "http://npm.zombielair.com:4873/read-all-stream/-/read-all-stream-2.1.2.tgz"
},
"directories": {},
"_resolved": "http://npm.zombielair.com:4873/read-all-stream/-/read-all-stream-2.1.2.tgz",
"readme": "ERROR: No README data found!"
"_resolved": "https://registry.npmjs.org/read-all-stream/-/read-all-stream-2.2.0.tgz"
}

@@ -12,3 +12,3 @@ {

"type": "git",
"url": "https://github.com/jshttp/statuses"
"url": "git+https://github.com/jshttp/statuses.git"
},

@@ -15,0 +15,0 @@ "license": "MIT",

@@ -8,3 +8,3 @@ {

"type": "git",
"url": "https://github.com/floatdrop/timed-out"
"url": "git+https://github.com/floatdrop/timed-out.git"
},

@@ -11,0 +11,0 @@ "author": {

{
"name": "got",
"version": "3.2.0",
"version": "3.3.0",
"description": "Simplified HTTP/HTTPS requests",

@@ -28,3 +28,3 @@ "license": "MIT",

"scripts": {
"test": "tape test/test-*.js | tap-dot",
"test": "tap test/test-*.js",
"coverage": "istanbul cover tape --report html -- test/test-*.js"

@@ -53,2 +53,3 @@ },

"infinity-agent": "^2.0.0",
"is-redirect": "^1.0.0",
"is-stream": "^1.0.0",

@@ -67,6 +68,5 @@ "lowercase-keys": "^1.0.0",

"pem": "^1.4.4",
"tap-dot": "^1.0.0",
"tape": "^3.5.0"
"tap": "^1.0.0"
},
"gitHead": "1fa82fb44810d835eb090ca28af7b72a9e6be527",
"gitHead": "3c728bc664cf0dd9dd4f77643b4e4a2878f86e9e",
"bugs": {

@@ -76,6 +76,7 @@ "url": "https://github.com/sindresorhus/got/issues"

"homepage": "https://github.com/sindresorhus/got",
"_id": "got@3.2.0",
"_shasum": "3182273b695da605c50003dc2d708217cf8156e9",
"_id": "got@3.3.0",
"_shasum": "6b1cb3d1f576c2491536f0d28b6cdd23aa4de3e9",
"_from": "got@>=3.2.0 <4.0.0",
"_npmVersion": "1.4.28",
"_npmVersion": "2.11.1",
"_nodeVersion": "2.3.0",
"_npmUser": {

@@ -86,8 +87,7 @@ "name": "floatdrop",

"dist": {
"shasum": "3182273b695da605c50003dc2d708217cf8156e9",
"tarball": "http://npm.zombielair.com:4873/got/-/got-3.2.0.tgz"
"shasum": "6b1cb3d1f576c2491536f0d28b6cdd23aa4de3e9",
"tarball": "http://registry.npmjs.org/got/-/got-3.3.0.tgz"
},
"directories": {},
"_resolved": "http://npm.zombielair.com:4873/got/-/got-3.2.0.tgz",
"readme": "ERROR: No README data found!"
"_resolved": "https://registry.npmjs.org/got/-/got-3.3.0.tgz"
}

@@ -1,5 +0,13 @@

# got [![Build Status](https://travis-ci.org/sindresorhus/got.svg?branch=master)](https://travis-ci.org/sindresorhus/got)
<h1 align="center">
<br>
<img width="360" src="https://rawgit.com/sindresorhus/got/master/media/logo.svg" alt="got">
<br>
<br>
<br>
</h1>
> Simplified HTTP/HTTPS requests
[![Build Status](https://travis-ci.org/sindresorhus/got.svg?branch=master)](https://travis-ci.org/sindresorhus/got)
A nicer interface to the built-in [`http`](http://nodejs.org/api/http.html) module.

@@ -51,2 +59,4 @@

Properties from `options` will override properties in parsed `url`.
##### options

@@ -66,2 +76,4 @@

If `content-length` or `transfer-encoding` is not set in `options.headers` and body is String or Buffer - `content-length` will be set to body length.
###### encoding

@@ -127,3 +139,6 @@

##### .on('error', error, body, response)
`error` event emitted in case of protocol error (like ENOTFOUND etc.) or status error (4xx or 5xx). Second argument is body of server response in case of status error. Third argument is response object.
###### response

@@ -182,4 +197,11 @@

## Created by
[![Sindre Sorhus](https://avatars.githubusercontent.com/u/170270?v=3&s=100)](http://sindresorhus.com) | [![Vsevolod Strukchinsky](https://avatars.githubusercontent.com/u/365089?v=3&s=100)](https://github.com/floatdrop)
---|---
[Sindre Sorhus](http://sindresorhus.com) | [Vsevolod Strukchinsky](https://github.com/floatdrop)
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

@@ -31,3 +31,3 @@ {

"_shasum": "300bc6e0e86374f7ba61068b5b1ecd57fc6532da",
"_from": "semver@4.3.6",
"_from": "semver@>=4.3.3 <5.0.0",
"_npmVersion": "2.10.1",

@@ -34,0 +34,0 @@ "_nodeVersion": "2.0.1",

@@ -23,7 +23,6 @@ {

},
"readme": "# spin.js\r\n\r\nAn animated CSS3 loading spinner with VML fallback for IE.\r\n\r\n * No images, no external CSS\r\n * No dependencies\r\n * Highly configurable\r\n * Resolution independent\r\n * Uses VML as fallback in old IEs\r\n * Uses @keyframe animations, falling back to setTimeout()\r\n * Works in all major browsers, including IE6\r\n * Small footprint (~1.9K gzipped)\r\n * MIT License\r\n\r\n## Usage\r\n\r\n```javascript\r\nnew Spinner({color:'#fff', lines: 12}).spin(target);\r\n```\r\n\r\nFor an interactive demo and a list of all supported options please refer to the [project's homepage](http://fgnass.github.com/spin.js).\r\n",
"_id": "spin@0.0.1",
"dist": {
"shasum": "246b756469c63b1f62f912f925b7eb2490e38cc6",
"tarball": "http://registry.npmjs.org/spin/-/spin-0.0.1.tgz"
"tarball": "http://npm.zombielair.com:4873/spin/-/spin-0.0.1.tgz"
},

@@ -37,4 +36,9 @@ "maintainers": [

"_shasum": "246b756469c63b1f62f912f925b7eb2490e38cc6",
"_resolved": "https://registry.npmjs.org/spin/-/spin-0.0.1.tgz",
"_from": "spin@0.0.1"
"_resolved": "http://npm.zombielair.com:4873/spin/-/spin-0.0.1.tgz",
"_from": "spin@0.0.1",
"bugs": {
"url": "https://github.com/visionmedia/spin.js/issues"
},
"readme": "ERROR: No README data found!",
"homepage": "https://github.com/visionmedia/spin.js#readme"
}
{
"name": "bl",
"version": "0.9.4",
"version": "1.0.0",
"description": "Buffer List: collect buffers and access with a standard readable Buffer interface, streamable too!",

@@ -12,3 +12,3 @@ "main": "bl.js",

"type": "git",
"url": "https://github.com/rvagg/bl.git"
"url": "git+https://github.com/rvagg/bl.git"
},

@@ -29,3 +29,3 @@ "homepage": "https://github.com/rvagg/bl",

"dependencies": {
"readable-stream": "~1.0.26"
"readable-stream": "~2.0.0"
},

@@ -38,11 +38,11 @@ "devDependencies": {

},
"gitHead": "e7f90703c5f90ca26f60455ea6ad0b6be4a9feee",
"gitHead": "1794938be6697a6d1e02cd942a4eea59b353347a",
"bugs": {
"url": "https://github.com/rvagg/bl/issues"
},
"_id": "bl@0.9.4",
"_shasum": "4702ddf72fbe0ecd82787c00c113aea1935ad0e7",
"_from": "bl@>=0.9.0 <0.10.0",
"_npmVersion": "2.1.18",
"_nodeVersion": "1.0.3",
"_id": "bl@1.0.0",
"_shasum": "ada9a8a89a6d7ac60862f7dec7db207873e0c3f5",
"_from": "bl@>=1.0.0 <2.0.0",
"_npmVersion": "2.9.0",
"_nodeVersion": "2.0.1-nightly20150618d2e4e03444",
"_npmUser": {

@@ -59,8 +59,8 @@ "name": "rvagg",

"dist": {
"shasum": "4702ddf72fbe0ecd82787c00c113aea1935ad0e7",
"tarball": "http://registry.npmjs.org/bl/-/bl-0.9.4.tgz"
"shasum": "ada9a8a89a6d7ac60862f7dec7db207873e0c3f5",
"tarball": "http://registry.npmjs.org/bl/-/bl-1.0.0.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/bl/-/bl-0.9.4.tgz",
"_resolved": "https://registry.npmjs.org/bl/-/bl-1.0.0.tgz",
"readme": "ERROR: No README data found!"
}
# bl *(BufferList)*
[![Build Status](https://travis-ci.org/rvagg/bl.svg?branch=master)](https://travis-ci.org/rvagg/bl)
**A Node.js Buffer list collector, reader and streamer thingy.**

@@ -4,0 +6,0 @@

@@ -18,3 +18,3 @@ {

"type": "git",
"url": "https://github.com/npm/wrappy"
"url": "git+https://github.com/npm/wrappy.git"
},

@@ -21,0 +21,0 @@ "author": {

@@ -1,22 +0,1 @@

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// a duplex stream is just a stream that is both readable and writable.

@@ -27,3 +6,3 @@ // Since JS doesn't have multiple prototypal inheritance, this class

module.exports = Duplex;
'use strict';

@@ -39,3 +18,11 @@ /*<replacement>*/

module.exports = Duplex;
/*<replacement>*/
var processNextTick = require('process-nextick-args');
/*</replacement>*/
/*<replacement>*/
var util = require('core-util-is');

@@ -50,6 +37,8 @@ util.inherits = require('inherits');

forEach(objectKeys(Writable.prototype), function(method) {
var keys = objectKeys(Writable.prototype);
for (var v = 0; v < keys.length; v++) {
var method = keys[v];
if (!Duplex.prototype[method])
Duplex.prototype[method] = Writable.prototype[method];
});
}

@@ -85,5 +74,9 @@ function Duplex(options) {

// But allow more writes to happen in this tick.
process.nextTick(this.end.bind(this));
processNextTick(onEndNT, this);
}
function onEndNT(self) {
self.end();
}
function forEach (xs, f) {

@@ -90,0 +83,0 @@ for (var i = 0, l = xs.length; i < l; i++) {

@@ -1,22 +0,1 @@

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// a passthrough stream.

@@ -26,2 +5,4 @@ // basically just the most minimal sort of Transform stream.

'use strict';
module.exports = PassThrough;

@@ -28,0 +9,0 @@

@@ -1,21 +0,2 @@

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';

@@ -25,2 +6,7 @@ module.exports = Readable;

/*<replacement>*/
var processNextTick = require('process-nextick-args');
/*</replacement>*/
/*<replacement>*/
var isArray = require('isarray');

@@ -44,5 +30,14 @@ /*</replacement>*/

var Stream = require('stream');
/*<replacement>*/
var Stream;
(function (){try{
Stream = require('st' + 'ream');
}catch(_){Stream = require('events').EventEmitter;}}())
/*</replacement>*/
var Buffer = require('buffer').Buffer;
/*<replacement>*/
var util = require('core-util-is');

@@ -52,2 +47,13 @@ util.inherits = require('inherits');

/*<replacement>*/
var debug = require('util');
if (debug && debug.debuglog) {
debug = debug.debuglog('stream');
} else {
debug = function () {};
}
/*</replacement>*/
var StringDecoder;

@@ -58,8 +64,18 @@

function ReadableState(options, stream) {
var Duplex = require('./_stream_duplex');
options = options || {};
// object stream flag. Used to make read(n) ignore n and to
// make all the buffer merging and length checks go away
this.objectMode = !!options.objectMode;
if (stream instanceof Duplex)
this.objectMode = this.objectMode || !!options.readableObjectMode;
// the point at which it stops calling _read() to fill the buffer
// Note: 0 is a valid value, means "don't call _read preemptively ever"
var hwm = options.highWaterMark;
this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;

@@ -73,3 +89,3 @@ // cast to ints.

this.pipesCount = 0;
this.flowing = false;
this.flowing = null;
this.ended = false;

@@ -79,10 +95,4 @@ this.endEmitted = false;

// In streams that never have any data, and do push(null) right away,
// the consumer can miss the 'end' event if they do some I/O before
// consuming the stream. So, we don't emit('end') until some reading
// happens.
this.calledRead = false;
// a flag to be able to tell if the onwrite cb is called immediately,
// or on a later tick. We set this to true at first, becuase any
// or on a later tick. We set this to true at first, because any
// actions that shouldn't happen until "later" should generally also

@@ -98,7 +108,2 @@ // not happen before the first write call.

// object stream flag. Used to make read(n) ignore n and to
// make all the buffer merging and length checks go away
this.objectMode = !!options.objectMode;
// Crypto is kind of old and crusty. Historically, its default string

@@ -130,2 +135,4 @@ // encoding is 'binary' so we have to make this configurable.

function Readable(options) {
var Duplex = require('./_stream_duplex');
if (!(this instanceof Readable))

@@ -139,2 +146,5 @@ return new Readable(options);

if (options && typeof options.read === 'function')
this._read = options.read;
Stream.call(this);

@@ -150,3 +160,3 @@ }

if (typeof chunk === 'string' && !state.objectMode) {
if (!state.objectMode && typeof chunk === 'string') {
encoding = encoding || state.defaultEncoding;

@@ -168,2 +178,6 @@ if (encoding !== state.encoding) {

Readable.prototype.isPaused = function() {
return this._readableState.flowing === false;
};
function readableAddChunk(stream, state, chunk, encoding, addToFront) {

@@ -173,6 +187,5 @@ var er = chunkInvalid(state, chunk);

stream.emit('error', er);
} else if (chunk === null || chunk === undefined) {
} else if (chunk === null) {
state.reading = false;
if (!state.ended)
onEofChunk(stream, state);
onEofChunk(stream, state);
} else if (state.objectMode || chunk && chunk.length > 0) {

@@ -189,14 +202,21 @@ if (state.ended && !addToFront) {

// update the buffer info.
state.length += state.objectMode ? 1 : chunk.length;
if (addToFront) {
state.buffer.unshift(chunk);
if (!addToFront)
state.reading = false;
// if we want the data now, just emit it.
if (state.flowing && state.length === 0 && !state.sync) {
stream.emit('data', chunk);
stream.read(0);
} else {
state.reading = false;
state.buffer.push(chunk);
// update the buffer info.
state.length += state.objectMode ? 1 : chunk.length;
if (addToFront)
state.buffer.unshift(chunk);
else
state.buffer.push(chunk);
if (state.needReadable)
emitReadable(stream);
}
if (state.needReadable)
emitReadable(stream);
maybeReadMore(stream, state);

@@ -233,2 +253,3 @@ }

this._readableState.encoding = enc;
return this;
};

@@ -280,4 +301,5 @@

return 0;
} else
} else {
return state.length;
}
}

@@ -290,6 +312,5 @@

Readable.prototype.read = function(n) {
debug('read', n);
var state = this._readableState;
state.calledRead = true;
var nOrig = n;
var ret;

@@ -305,3 +326,7 @@ if (typeof n !== 'number' || n > 0)

(state.length >= state.highWaterMark || state.ended)) {
emitReadable(this);
debug('read: emitReadable', state.length, state.ended);
if (state.length === 0 && state.ended)
endReadable(this);
else
emitReadable(this);
return null;

@@ -314,24 +339,5 @@ }

if (n === 0 && state.ended) {
ret = null;
// In cases where the decoder did not receive enough data
// to produce a full chunk, then immediately received an
// EOF, state.buffer will contain [<Buffer >, <Buffer 00 ...>].
// howMuchToRead will see this and coerce the amount to
// read to zero (because it's looking at the length of the
// first <Buffer > in state.buffer), and we'll end up here.
//
// This can only happen via state.decoder -- no other venue
// exists for pushing a zero-length chunk into state.buffer
// and triggering this behavior. In this case, we return our
// remaining data and end the stream, if appropriate.
if (state.length > 0 && state.decoder) {
ret = fromList(n, state);
state.length -= ret.length;
}
if (state.length === 0)
endReadable(this);
return ret;
return null;
}

@@ -363,13 +369,19 @@

var doRead = state.needReadable;
debug('need readable', doRead);
// if we currently have less than the highWaterMark, then also read some
if (state.length - n <= state.highWaterMark)
if (state.length === 0 || state.length - n < state.highWaterMark) {
doRead = true;
debug('length less than watermark', doRead);
}
// however, if we've ended, then there's no point, and if we're already
// reading, then it's unnecessary.
if (state.ended || state.reading)
if (state.ended || state.reading) {
doRead = false;
debug('reading or ended', doRead);
}
if (doRead) {
debug('do read');
state.reading = true;

@@ -385,8 +397,8 @@ state.sync = true;

// If _read called its callback synchronously, then `reading`
// will be false, and we need to re-evaluate how much data we
// can return to the user.
// If _read pushed data synchronously, then `reading` will be false,
// and we need to re-evaluate how much data we can return to the user.
if (doRead && !state.reading)
n = howMuchToRead(nOrig, state);
var ret;
if (n > 0)

@@ -409,8 +421,9 @@ ret = fromList(n, state);

// If we happened to read() exactly the remaining amount in the
// buffer, and the EOF has been seen at this point, then make sure
// that we emit 'end' on the very next tick.
if (state.ended && !state.endEmitted && state.length === 0)
// If we tried to read() past the EOF, then emit end on the next tick.
if (nOrig !== n && state.ended && state.length === 0)
endReadable(this);
if (ret !== null)
this.emit('data', ret);
return ret;

@@ -421,4 +434,4 @@ };

var er = null;
if (!Buffer.isBuffer(chunk) &&
'string' !== typeof chunk &&
if (!(Buffer.isBuffer(chunk)) &&
typeof chunk !== 'string' &&
chunk !== null &&

@@ -434,3 +447,4 @@ chunk !== undefined &&

function onEofChunk(stream, state) {
if (state.decoder && !state.ended) {
if (state.ended) return;
if (state.decoder) {
var chunk = state.decoder.end();

@@ -444,8 +458,4 @@ if (chunk && chunk.length) {

// if we've ended and we have some data left, then emit
// 'readable' now to make sure it gets picked up.
if (state.length > 0)
emitReadable(stream);
else
endReadable(stream);
// emit 'readable' now to make sure it gets picked up.
emitReadable(stream);
}

@@ -459,16 +469,16 @@

state.needReadable = false;
if (state.emittedReadable)
return;
state.emittedReadable = true;
if (state.sync)
process.nextTick(function() {
if (!state.emittedReadable) {
debug('emitReadable', state.flowing);
state.emittedReadable = true;
if (state.sync)
processNextTick(emitReadable_, stream);
else
emitReadable_(stream);
});
else
emitReadable_(stream);
}
}
function emitReadable_(stream) {
debug('emit readable');
stream.emit('readable');
flow(stream);
}

@@ -486,5 +496,3 @@

state.readingMore = true;
process.nextTick(function() {
maybeReadMore_(stream, state);
});
processNextTick(maybeReadMore_, stream, state);
}

@@ -497,2 +505,3 @@ }

state.length < state.highWaterMark) {
debug('maybeReadMore read 0');
stream.read(0);

@@ -532,2 +541,3 @@ if (len === state.length)

state.pipesCount += 1;
debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);

@@ -540,3 +550,3 @@ var doEnd = (!pipeOpts || pipeOpts.end !== false) &&

if (state.endEmitted)
process.nextTick(endFn);
processNextTick(endFn);
else

@@ -547,7 +557,10 @@ src.once('end', endFn);

function onunpipe(readable) {
if (readable !== src) return;
cleanup();
debug('onunpipe');
if (readable === src) {
cleanup();
}
}
function onend() {
debug('onend');
dest.end();

@@ -564,2 +577,3 @@ }

function cleanup() {
debug('cleanup');
// cleanup event handlers once the pipe is broken

@@ -573,2 +587,3 @@ dest.removeListener('close', onclose);

src.removeListener('end', cleanup);
src.removeListener('data', ondata);

@@ -580,9 +595,23 @@ // if the reader is waiting for a drain event from this

// If we don't know, then assume that we are waiting for one.
if (!dest._writableState || dest._writableState.needDrain)
if (state.awaitDrain &&
(!dest._writableState || dest._writableState.needDrain))
ondrain();
}
src.on('data', ondata);
function ondata(chunk) {
debug('ondata');
var ret = dest.write(chunk);
if (false === ret) {
debug('false write response, pause',
src._readableState.awaitDrain);
src._readableState.awaitDrain++;
src.pause();
}
}
// if the dest has an error, then stop piping into it.
// however, don't suppress the throwing behavior for this.
function onerror(er) {
debug('onerror', er);
unpipe();

@@ -611,2 +640,3 @@ dest.removeListener('error', onerror);

function onfinish() {
debug('onfinish');
dest.removeListener('close', onclose);

@@ -618,2 +648,3 @@ unpipe();

function unpipe() {
debug('unpipe');
src.unpipe(dest);

@@ -627,12 +658,4 @@ }

if (!state.flowing) {
// the handler that waits for readable events after all
// the data gets sucked out in flow.
// This would be easier to follow with a .once() handler
// in flow(), but that is too slow.
this.on('readable', pipeOnReadable);
state.flowing = true;
process.nextTick(function() {
flow(src);
});
debug('pipe resume');
src.resume();
}

@@ -645,62 +668,14 @@

return function() {
var dest = this;
var state = src._readableState;
state.awaitDrain--;
if (state.awaitDrain === 0)
debug('pipeOnDrain', state.awaitDrain);
if (state.awaitDrain)
state.awaitDrain--;
if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) {
state.flowing = true;
flow(src);
}
};
}
function flow(src) {
var state = src._readableState;
var chunk;
state.awaitDrain = 0;
function write(dest, i, list) {
var written = dest.write(chunk);
if (false === written) {
state.awaitDrain++;
}
}
while (state.pipesCount && null !== (chunk = src.read())) {
if (state.pipesCount === 1)
write(state.pipes, 0, null);
else
forEach(state.pipes, write);
src.emit('data', chunk);
// if anyone needs a drain, then we have to wait for that.
if (state.awaitDrain > 0)
return;
}
// if every destination was unpiped, either before entering this
// function, or in the while loop, then stop flowing.
//
// NB: This is a pretty rare edge case.
if (state.pipesCount === 0) {
state.flowing = false;
// if there were data event listeners added, then switch to old mode.
if (EE.listenerCount(src, 'data') > 0)
emitDataEvents(src);
return;
}
// at this point, no one needed a drain, so we just ran out of data
// on the next readable event, start it over again.
state.ranOut = true;
}
function pipeOnReadable() {
if (this._readableState.ranOut) {
this._readableState.ranOut = false;
flow(this);
}
}
Readable.prototype.unpipe = function(dest) {

@@ -725,3 +700,2 @@ var state = this._readableState;

state.pipesCount = 0;
this.removeListener('readable', pipeOnReadable);
state.flowing = false;

@@ -741,3 +715,2 @@ if (dest)

state.pipesCount = 0;
this.removeListener('readable', pipeOnReadable);
state.flowing = false;

@@ -770,4 +743,7 @@

if (ev === 'data' && !this._readableState.flowing)
emitDataEvents(this);
// If listening to data, and it has not explicitly been paused,
// then call resume to start the flow of data on the next tick.
if (ev === 'data' && false !== this._readableState.flowing) {
this.resume();
}

@@ -781,3 +757,3 @@ if (ev === 'readable' && this.readable) {

if (!state.reading) {
this.read(0);
processNextTick(nReadingNextTick, this);
} else if (state.length) {

@@ -793,62 +769,57 @@ emitReadable(this, state);

function nReadingNextTick(self) {
debug('readable nexttick read 0');
self.read(0);
}
// pause() and resume() are remnants of the legacy readable stream API
// If the user uses them, then switch into old mode.
Readable.prototype.resume = function() {
emitDataEvents(this);
this.read(0);
this.emit('resume');
var state = this._readableState;
if (!state.flowing) {
debug('resume');
state.flowing = true;
resume(this, state);
}
return this;
};
function resume(stream, state) {
if (!state.resumeScheduled) {
state.resumeScheduled = true;
processNextTick(resume_, stream, state);
}
}
function resume_(stream, state) {
if (!state.reading) {
debug('resume read 0');
stream.read(0);
}
state.resumeScheduled = false;
stream.emit('resume');
flow(stream);
if (state.flowing && !state.reading)
stream.read(0);
}
Readable.prototype.pause = function() {
emitDataEvents(this, true);
this.emit('pause');
debug('call pause flowing=%j', this._readableState.flowing);
if (false !== this._readableState.flowing) {
debug('pause');
this._readableState.flowing = false;
this.emit('pause');
}
return this;
};
function emitDataEvents(stream, startPaused) {
function flow(stream) {
var state = stream._readableState;
debug('flow', state.flowing);
if (state.flowing) {
// https://github.com/isaacs/readable-stream/issues/16
throw new Error('Cannot switch to old mode now.');
do {
var chunk = stream.read();
} while (null !== chunk && state.flowing);
}
var paused = startPaused || false;
var readable = false;
// convert to an old-style stream.
stream.readable = true;
stream.pipe = Stream.prototype.pipe;
stream.on = stream.addListener = Stream.prototype.on;
stream.on('readable', function() {
readable = true;
var c;
while (!paused && (null !== (c = stream.read())))
stream.emit('data', c);
if (c === null) {
readable = false;
stream._readableState.needReadable = true;
}
});
stream.pause = function() {
paused = true;
this.emit('pause');
};
stream.resume = function() {
paused = false;
if (readable)
process.nextTick(function() {
stream.emit('readable');
});
else
this.read(0);
this.emit('resume');
};
// now make it start, just in case it hadn't already.
stream.emit('readable');
}

@@ -865,2 +836,3 @@

stream.on('end', function() {
debug('wrapped end');
if (state.decoder && !state.ended) {

@@ -876,2 +848,3 @@ var chunk = state.decoder.end();

stream.on('data', function(chunk) {
debug('wrapped data');
if (state.decoder)

@@ -881,3 +854,2 @@ chunk = state.decoder.write(chunk);

// don't skip over falsy values in objectMode
//if (state.objectMode && util.isNullOrUndefined(chunk))
if (state.objectMode && (chunk === null || chunk === undefined))

@@ -898,7 +870,6 @@ return;

for (var i in stream) {
if (typeof stream[i] === 'function' &&
typeof this[i] === 'undefined') {
if (this[i] === undefined && typeof stream[i] === 'function') {
this[i] = function(method) { return function() {
return stream[method].apply(stream, arguments);
}}(i);
}; }(i);
}

@@ -916,2 +887,3 @@ }

self._read = function(n) {
debug('wrapped _read', n);
if (paused) {

@@ -1005,15 +977,17 @@ paused = false;

if (!state.endEmitted && state.calledRead) {
if (!state.endEmitted) {
state.ended = true;
process.nextTick(function() {
// Check that we didn't get one last unshift.
if (!state.endEmitted && state.length === 0) {
state.endEmitted = true;
stream.readable = false;
stream.emit('end');
}
});
processNextTick(endReadableNT, state, stream);
}
}
function endReadableNT(state, stream) {
// Check that we didn't get one last unshift.
if (!state.endEmitted && state.length === 0) {
state.endEmitted = true;
stream.readable = false;
stream.emit('end');
}
}
function forEach (xs, f) {

@@ -1020,0 +994,0 @@ for (var i = 0, l = xs.length; i < l; i++) {

@@ -1,23 +0,1 @@

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// a transform stream is a readable/writable stream where you do

@@ -65,2 +43,4 @@ // something with the data. Sometimes it's called a "filter",

'use strict';
module.exports = Transform;

@@ -78,3 +58,3 @@

function TransformState(options, stream) {
function TransformState(stream) {
this.afterTransform = function(er, data) {

@@ -122,3 +102,3 @@ return afterTransform(stream, er, data);

var ts = this._transformState = new TransformState(options, this);
this._transformState = new TransformState(this);

@@ -136,4 +116,12 @@ // when the writable side finishes, then flush out anything remaining.

this.once('finish', function() {
if ('function' === typeof this._flush)
if (options) {
if (typeof options.transform === 'function')
this._transform = options.transform;
if (typeof options.flush === 'function')
this._flush = options.flush;
}
this.once('prefinish', function() {
if (typeof this._flush === 'function')
this._flush(function(er) {

@@ -204,3 +192,2 @@ done(stream, er);

var ws = stream._writableState;
var rs = stream._readableState;
var ts = stream._transformState;

@@ -207,0 +194,0 @@

@@ -1,22 +0,1 @@

// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// A bit simpler than readable streams.

@@ -26,5 +5,12 @@ // Implement an async ._write(chunk, cb), and it'll handle all

'use strict';
module.exports = Writable;
/*<replacement>*/
var processNextTick = require('process-nextick-args');
/*</replacement>*/
/*<replacement>*/
var Buffer = require('buffer').Buffer;

@@ -41,6 +27,17 @@ /*</replacement>*/

var Stream = require('stream');
/*<replacement>*/
var Stream;
(function (){try{
Stream = require('st' + 'ream');
}catch(_){Stream = require('events').EventEmitter;}}())
/*</replacement>*/
var Buffer = require('buffer').Buffer;
util.inherits(Writable, Stream);
function nop() {}
function WriteReq(chunk, encoding, cb) {

@@ -50,7 +47,17 @@ this.chunk = chunk;

this.callback = cb;
this.next = null;
}
function WritableState(options, stream) {
var Duplex = require('./_stream_duplex');
options = options || {};
// object stream flag to indicate whether or not this stream
// contains buffers or objects.
this.objectMode = !!options.objectMode;
if (stream instanceof Duplex)
this.objectMode = this.objectMode || !!options.writableObjectMode;
// the point at which write() starts returning false

@@ -60,8 +67,5 @@ // Note: 0 is a valid value, means that we always return false if

var hwm = options.highWaterMark;
this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
// object stream flag to indicate whether or not this stream
// contains buffers or objects.
this.objectMode = !!options.objectMode;
// cast to ints.

@@ -97,4 +101,7 @@ this.highWaterMark = ~~this.highWaterMark;

// when true all writes will be buffered until .uncork() call
this.corked = 0;
// a flag to be able to tell if the onwrite cb is called immediately,
// or on a later tick. We set this to true at first, becuase any
// or on a later tick. We set this to true at first, because any
// actions that shouldn't happen until "later" should generally also

@@ -120,4 +127,13 @@ // not happen before the first write call.

this.buffer = [];
this.bufferedRequest = null;
this.lastBufferedRequest = null;
// number of pending user-supplied write callbacks
// this must be 0 before 'finish' can be emitted
this.pendingcb = 0;
// emit prefinish if the only thing we're waiting for is _write cbs
// This is relevant for synchronous Transform streams
this.prefinished = false;
// True if the error was already emitted and should not be thrown again

@@ -127,2 +143,22 @@ this.errorEmitted = false;

WritableState.prototype.getBuffer = function writableStateGetBuffer() {
var current = this.bufferedRequest;
var out = [];
while (current) {
out.push(current);
current = current.next;
}
return out;
};
(function (){try {
Object.defineProperty(WritableState.prototype, 'buffer', {
get: require('util-deprecate')(function() {
return this.getBuffer();
}, '_writableState.buffer is deprecated. Use ' +
'_writableState.getBuffer() instead.')
});
}catch(_){}}());
function Writable(options) {

@@ -141,2 +177,10 @@ var Duplex = require('./_stream_duplex');

if (options) {
if (typeof options.write === 'function')
this._write = options.write;
if (typeof options.writev === 'function')
this._writev = options.writev;
}
Stream.call(this);

@@ -151,9 +195,7 @@ }

function writeAfterEnd(stream, state, cb) {
function writeAfterEnd(stream, cb) {
var er = new Error('write after end');
// TODO: defer error events consistently everywhere, not just the cb
stream.emit('error', er);
process.nextTick(function() {
cb(er);
});
processNextTick(cb, er);
}

@@ -168,4 +210,5 @@

var valid = true;
if (!Buffer.isBuffer(chunk) &&
'string' !== typeof chunk &&
if (!(Buffer.isBuffer(chunk)) &&
typeof chunk !== 'string' &&
chunk !== null &&

@@ -176,5 +219,3 @@ chunk !== undefined &&

stream.emit('error', er);
process.nextTick(function() {
cb(er);
});
processNextTick(cb, er);
valid = false;

@@ -200,8 +241,10 @@ }

if (typeof cb !== 'function')
cb = function() {};
cb = nop;
if (state.ended)
writeAfterEnd(this, state, cb);
else if (validChunk(this, state, chunk, cb))
writeAfterEnd(this, cb);
else if (validChunk(this, state, chunk, cb)) {
state.pendingcb++;
ret = writeOrBuffer(this, state, chunk, encoding, cb);
}

@@ -211,2 +254,34 @@ return ret;

Writable.prototype.cork = function() {
var state = this._writableState;
state.corked++;
};
Writable.prototype.uncork = function() {
var state = this._writableState;
if (state.corked) {
state.corked--;
if (!state.writing &&
!state.corked &&
!state.finished &&
!state.bufferProcessing &&
state.bufferedRequest)
clearBuffer(this, state);
}
};
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
// node::ParseEncoding() requires lower case.
if (typeof encoding === 'string')
encoding = encoding.toLowerCase();
if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64',
'ucs2', 'ucs-2','utf16le', 'utf-16le', 'raw']
.indexOf((encoding + '').toLowerCase()) > -1))
throw new TypeError('Unknown encoding: ' + encoding);
this._writableState.defaultEncoding = encoding;
};
function decodeChunk(state, chunk, encoding) {

@@ -226,2 +301,3 @@ if (!state.objectMode &&

chunk = decodeChunk(state, chunk, encoding);
if (Buffer.isBuffer(chunk))

@@ -238,6 +314,13 @@ encoding = 'buffer';

if (state.writing)
state.buffer.push(new WriteReq(chunk, encoding, cb));
else
doWrite(stream, state, len, chunk, encoding, cb);
if (state.writing || state.corked) {
var last = state.lastBufferedRequest;
state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
if (last) {
last.next = state.lastBufferedRequest;
} else {
state.bufferedRequest = state.lastBufferedRequest;
}
} else {
doWrite(stream, state, false, len, chunk, encoding, cb);
}

@@ -247,3 +330,3 @@ return ret;

function doWrite(stream, state, len, chunk, encoding, cb) {
function doWrite(stream, state, writev, len, chunk, encoding, cb) {
state.writelen = len;

@@ -253,3 +336,6 @@ state.writecb = cb;

state.sync = true;
stream._write(chunk, encoding, state.onwrite);
if (writev)
stream._writev(chunk, state.onwrite);
else
stream._write(chunk, encoding, state.onwrite);
state.sync = false;

@@ -259,6 +345,5 @@ }

function onwriteError(stream, state, sync, er, cb) {
--state.pendingcb;
if (sync)
process.nextTick(function() {
cb(er);
});
processNextTick(cb, er);
else

@@ -289,11 +374,13 @@ cb(er);

// Check if we're actually ready to finish, but don't emit yet
var finished = needFinish(stream, state);
var finished = needFinish(state);
if (!finished && !state.bufferProcessing && state.buffer.length)
if (!finished &&
!state.corked &&
!state.bufferProcessing &&
state.bufferedRequest) {
clearBuffer(stream, state);
}
if (sync) {
process.nextTick(function() {
afterWrite(stream, state, finished, cb);
});
processNextTick(afterWrite, stream, state, finished, cb);
} else {

@@ -308,5 +395,5 @@ afterWrite(stream, state, finished, cb);

onwriteDrain(stream, state);
state.pendingcb--;
cb();
if (finished)
finishMaybe(stream, state);
finishMaybe(stream, state);
}

@@ -328,27 +415,50 @@

state.bufferProcessing = true;
var entry = state.bufferedRequest;
for (var c = 0; c < state.buffer.length; c++) {
var entry = state.buffer[c];
var chunk = entry.chunk;
var encoding = entry.encoding;
var cb = entry.callback;
var len = state.objectMode ? 1 : chunk.length;
if (stream._writev && entry && entry.next) {
// Fast case, write everything using _writev()
var buffer = [];
var cbs = [];
while (entry) {
cbs.push(entry.callback);
buffer.push(entry);
entry = entry.next;
}
doWrite(stream, state, len, chunk, encoding, cb);
// count the one we are adding, as well.
// TODO(isaacs) clean this up
state.pendingcb++;
state.lastBufferedRequest = null;
doWrite(stream, state, true, state.length, buffer, '', function(err) {
for (var i = 0; i < cbs.length; i++) {
state.pendingcb--;
cbs[i](err);
}
});
// if we didn't call the onwrite immediately, then
// it means that we need to wait until it does.
// also, that means that the chunk and cb are currently
// being processed, so move the buffer counter past them.
if (state.writing) {
c++;
break;
// Clear buffer
} else {
// Slow case, write chunks one-by-one
while (entry) {
var chunk = entry.chunk;
var encoding = entry.encoding;
var cb = entry.callback;
var len = state.objectMode ? 1 : chunk.length;
doWrite(stream, state, false, len, chunk, encoding, cb);
entry = entry.next;
// if we didn't call the onwrite immediately, then
// it means that we need to wait until it does.
// also, that means that the chunk and cb are currently
// being processed, so move the buffer counter past them.
if (state.writing) {
break;
}
}
if (entry === null)
state.lastBufferedRequest = null;
}
state.bufferedRequest = entry;
state.bufferProcessing = false;
if (c < state.buffer.length)
state.buffer = state.buffer.slice(c);
else
state.buffer.length = 0;
}

@@ -360,2 +470,4 @@

Writable.prototype._writev = null;
Writable.prototype.end = function(chunk, encoding, cb) {

@@ -373,5 +485,11 @@ var state = this._writableState;

if (typeof chunk !== 'undefined' && chunk !== null)
if (chunk !== null && chunk !== undefined)
this.write(chunk, encoding);
// .end() fully uncorks
if (state.corked) {
state.corked = 1;
this.uncork();
}
// ignore unnecessary end() calls.

@@ -383,5 +501,6 @@ if (!state.ending && !state.finished)

function needFinish(stream, state) {
function needFinish(state) {
return (state.ending &&
state.length === 0 &&
state.bufferedRequest === null &&
!state.finished &&

@@ -391,7 +510,19 @@ !state.writing);

function prefinish(stream, state) {
if (!state.prefinished) {
state.prefinished = true;
stream.emit('prefinish');
}
}
function finishMaybe(stream, state) {
var need = needFinish(stream, state);
var need = needFinish(state);
if (need) {
state.finished = true;
stream.emit('finish');
if (state.pendingcb === 0) {
prefinish(stream, state);
state.finished = true;
stream.emit('finish');
} else {
prefinish(stream, state);
}
}

@@ -406,3 +537,3 @@ return need;

if (state.finished)
process.nextTick(cb);
processNextTick(cb);
else

@@ -409,0 +540,0 @@ stream.once('finish', cb);

@@ -8,3 +8,3 @@ {

"type": "git",
"url": "git://github.com/isaacs/core-util-is"
"url": "git://github.com/isaacs/core-util-is.git"
},

@@ -11,0 +11,0 @@ "keywords": [

@@ -19,3 +19,3 @@ {

"type": "git",
"url": "git://github.com/isaacs/inherits"
"url": "git://github.com/isaacs/inherits.git"
},

@@ -22,0 +22,0 @@ "license": "ISC",

{
"name": "readable-stream",
"version": "1.0.33",
"description": "Streams2, a user-land copy of the stream library from Node.js v0.10.x",
"version": "2.0.1",
"description": "Streams3, a user-land copy of the stream library from iojs v2.x",
"main": "readable.js",
"dependencies": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"process-nextick-args": "~1.0.0",
"string_decoder": "~0.10.x",
"inherits": "~2.0.1"
"util-deprecate": "~1.0.1"
},
"devDependencies": {
"tap": "~0.2.6"
"tap": "~0.2.6",
"tape": "~4.0.0",
"zuul": "~3.0.0"
},
"scripts": {
"test": "tap test/simple/*.js"
"test": "tap test/parallel/*.js",
"browser": "zuul --browser-name $BROWSER_NAME --browser-version $BROWSER_VERSION -- test/browser.js"
},
"repository": {
"type": "git",
"url": "git://github.com/isaacs/readable-stream"
"url": "git://github.com/nodejs/readable-stream.git"
},

@@ -30,25 +35,25 @@ "keywords": [

},
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"license": "MIT",
"gitHead": "0bf97a117c5646556548966409ebc57a6dda2638",
"gitHead": "d175d0f68745a5014fc9c41b25b8e0e959269126",
"bugs": {
"url": "https://github.com/isaacs/readable-stream/issues"
"url": "https://github.com/nodejs/readable-stream/issues"
},
"homepage": "https://github.com/isaacs/readable-stream",
"_id": "readable-stream@1.0.33",
"_shasum": "3a360dd66c1b1d7fd4705389860eda1d0f61126c",
"_from": "readable-stream@>=1.0.33 <1.1.0",
"_npmVersion": "1.4.28",
"homepage": "https://github.com/nodejs/readable-stream#readme",
"_id": "readable-stream@2.0.1",
"_shasum": "633479b7bd2fbe7a1e869825b40a0b333b9f2bfc",
"_from": "readable-stream@>=2.0.0 <3.0.0",
"_npmVersion": "2.11.1",
"_nodeVersion": "2.3.0",
"_npmUser": {
"name": "rvagg",
"email": "rod@vagg.org"
"name": "cwmma",
"email": "calvin.metcalf@gmail.com"
},
"dist": {
"shasum": "633479b7bd2fbe7a1e869825b40a0b333b9f2bfc",
"tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.0.1.tgz"
},
"maintainers": [
{
"name": "isaacs",
"email": "i@izs.me"
"email": "isaacs@npmjs.com"
},

@@ -62,11 +67,11 @@ {

"email": "rod@vagg.org"
},
{
"name": "cwmma",
"email": "calvin.metcalf@gmail.com"
}
],
"dist": {
"shasum": "3a360dd66c1b1d7fd4705389860eda1d0f61126c",
"tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz",
"_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.1.tgz",
"readme": "ERROR: No README data found!"
}

@@ -1,4 +0,8 @@

var Stream = require('stream'); // hack to fix a circular dependency issue when used with browserify
var Stream = (function (){
try {
return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify
} catch(_){}
}());
exports = module.exports = require('./lib/_stream_readable.js');
exports.Stream = Stream;
exports.Stream = Stream || exports;
exports.Readable = exports;

@@ -5,0 +9,0 @@ exports.Writable = require('./lib/_stream_writable.js');

# readable-stream
***Node-core streams for userland***
***Node-core streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream)
[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/)
[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/)
This package is a mirror of the Streams2 and Streams3 implementations in Node-core.
If you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core.
[![Sauce Test Status](https://saucelabs.com/browser-matrix/readable-stream.svg)](https://saucelabs.com/u/readable-stream)
**readable-stream** comes in two major versions, v1.0.x and v1.1.x. The former tracks the Streams2 implementation in Node 0.10, including bug-fixes and minor improvements as they are added. The latter tracks Streams3 as it develops in Node 0.11; we will likely see a v1.2.x branch for Node 0.12.
```bash
npm install --save readable-stream
```
**readable-stream** uses proper patch-level versioning so if you pin to `"~1.0.0"` you’ll get the latest Node 0.10 Streams2 implementation, including any fixes and minor non-breaking improvements. The patch-level versions of 1.0.x and 1.1.x should mirror the patch-level versions of Node-core releases. You should prefer the **1.0.x** releases for now and when you’re ready to start using Streams3, pin to `"~1.1.0"`
***Node-core streams for userland***
This package is a mirror of the Streams2 and Streams3 implementations in
Node-core, including [documentation](doc/stream.markdown).
If you want to guarantee a stable streams base, regardless of what version of
Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).
As of version 2.0.0 **readable-stream** uses semantic versioning.
# Streams WG Team Members
* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) &lt;christopher.s.dickinson@gmail.com&gt;
- Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B
* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) &lt;calvin.metcalf@gmail.com&gt;
- Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242
* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) &lt;rod@vagg.org&gt;
- Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D
* **Sam Newman** ([@sonewman](https://github.com/sonewman)) &lt;newmansam@outlook.com&gt;
* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) &lt;mathiasbuus@gmail.com&gt;
* **Domenic Denicola** ([@domenic](https://github.com/domenic)) &lt;d@domenic.me&gt;
{
"name": "tar-stream",
"version": "1.1.5",
"version": "1.2.1",
"description": "tar-stream is a streaming tar parser and generator and nothing else. It is streams2 and operates purely using streams which means you can easily extract/parse tarballs without ever hitting the file system.",

@@ -13,5 +13,5 @@ "author": {

"dependencies": {
"bl": "^0.9.0",
"bl": "^1.0.0",
"end-of-stream": "^1.0.0",
"readable-stream": "~1.0.33",
"readable-stream": "^2.0.0",
"xtend": "^4.0.0"

@@ -59,12 +59,16 @@ },

},
"gitHead": "72e8736c83455192fdcc20c0252d9df9f83350df",
"_id": "tar-stream@1.1.5",
"_shasum": "be9218c130c20029e107b0f967fb23de0579d13c",
"_from": "tar-stream@1.1.5",
"_npmVersion": "2.9.0",
"_nodeVersion": "2.0.0",
"gitHead": "02bbe131f2c7df3fa1f44fecdf96d6241d0cf412",
"_id": "tar-stream@1.2.1",
"_shasum": "7b09e93b93f02bce74f060d5f2146ac7cccf6021",
"_from": "tar-stream@>=1.1.4 <2.0.0",
"_npmVersion": "2.11.0",
"_nodeVersion": "2.2.1",
"_npmUser": {
"name": "maxogden",
"email": "max@maxogden.com"
"name": "mafintosh",
"email": "mathiasbuus@gmail.com"
},
"dist": {
"shasum": "7b09e93b93f02bce74f060d5f2146ac7cccf6021",
"tarball": "http://registry.npmjs.org/tar-stream/-/tar-stream-1.2.1.tgz"
},
"maintainers": [

@@ -80,8 +84,4 @@ {

],
"dist": {
"shasum": "be9218c130c20029e107b0f967fb23de0579d13c",
"tarball": "http://npm.zombielair.com:4873/tar-stream/-/tar-stream-1.1.5.tgz"
},
"_resolved": "http://npm.zombielair.com:4873/tar-stream/-/tar-stream-1.1.5.tgz",
"_resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.2.1.tgz",
"readme": "ERROR: No README data found!"
}
{
"name": "electron-updater",
"version": "0.0.7",
"version": "0.0.8",
"description": "Cross platform auto-updater for electron applications",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc