pax_global_header00006660000000000000000000000064125674532470014531gustar00rootroot0000000000000052 comment=4a0cda308582b8d9dda7261b63d0437298414849 stream-browserify-2.0.1/000077500000000000000000000000001256745324700152155ustar00rootroot00000000000000stream-browserify-2.0.1/.gitignore000066400000000000000000000000151256745324700172010ustar00rootroot00000000000000node_modules stream-browserify-2.0.1/.travis.yml000066400000000000000000000001711256745324700173250ustar00rootroot00000000000000sudo: false language: node_js node_js: - 'iojs' - '0.12' - '0.10' - '0.8' before_install: - npm install -g npm stream-browserify-2.0.1/LICENSE000066400000000000000000000020611256745324700162210ustar00rootroot00000000000000This software is released under the MIT license: 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. stream-browserify-2.0.1/index.js000066400000000000000000000070531256745324700166670ustar00rootroot00000000000000// 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. module.exports = Stream; var EE = require('events').EventEmitter; var inherits = require('inherits'); inherits(Stream, EE); Stream.Readable = require('readable-stream/readable.js'); Stream.Writable = require('readable-stream/writable.js'); Stream.Duplex = require('readable-stream/duplex.js'); Stream.Transform = require('readable-stream/transform.js'); Stream.PassThrough = require('readable-stream/passthrough.js'); // Backwards-compat with node 0.4.x Stream.Stream = Stream; // old-style streams. Note that the pipe method (the only relevant // part of this class) is overridden in the Readable class. function Stream() { EE.call(this); } Stream.prototype.pipe = function(dest, options) { var source = this; function ondata(chunk) { if (dest.writable) { if (false === dest.write(chunk) && source.pause) { source.pause(); } } } source.on('data', ondata); function ondrain() { if (source.readable && source.resume) { source.resume(); } } dest.on('drain', ondrain); // If the 'end' option is not supplied, dest.end() will be called when // source gets the 'end' or 'close' events. Only dest.end() once. if (!dest._isStdio && (!options || options.end !== false)) { source.on('end', onend); source.on('close', onclose); } var didOnEnd = false; function onend() { if (didOnEnd) return; didOnEnd = true; dest.end(); } function onclose() { if (didOnEnd) return; didOnEnd = true; if (typeof dest.destroy === 'function') dest.destroy(); } // don't leave dangling pipes when there are errors. function onerror(er) { cleanup(); if (EE.listenerCount(this, 'error') === 0) { throw er; // Unhandled stream error in pipe. } } source.on('error', onerror); dest.on('error', onerror); // remove all the event listeners that were added. function cleanup() { source.removeListener('data', ondata); dest.removeListener('drain', ondrain); source.removeListener('end', onend); source.removeListener('close', onclose); source.removeListener('error', onerror); dest.removeListener('error', onerror); source.removeListener('end', cleanup); source.removeListener('close', cleanup); dest.removeListener('close', cleanup); } source.on('end', cleanup); source.on('close', cleanup); dest.on('close', cleanup); dest.emit('pipe', source); // Allow for unix-like usage: A.pipe(B).pipe(C) return dest; }; stream-browserify-2.0.1/package.json000066400000000000000000000021261256745324700175040ustar00rootroot00000000000000{ "name": "stream-browserify", "version": "2.0.1", "description": "the stream module from node core for browsers", "main": "index.js", "dependencies": { "inherits": "~2.0.1", "readable-stream": "^2.0.2" }, "devDependencies": { "typedarray": "~0.0.6", "tape": "^4.2.0" }, "scripts": { "test": "tape test/*.js" }, "repository": { "type": "git", "url": "git://github.com/substack/stream-browserify.git" }, "homepage": "https://github.com/substack/stream-browserify", "keywords": [ "stream", "browser", "browserify" ], "author": { "name": "James Halliday", "email": "mail@substack.net", "url": "http://substack.net" }, "license": "MIT", "testling": { "files": "test/*.js", "browsers": [ "ie/8..latest", "firefox/3.5", "firefox/10", "firefox/nightly", "chrome/10", "chrome/latest", "chrome/canary", "opera/12..latest", "opera/next", "safari/5.1..latest", "ipad/6.0..latest", "iphone/6.0..latest", "android-browser/4.2..latest" ] } } stream-browserify-2.0.1/readme.markdown000066400000000000000000000010011256745324700202060ustar00rootroot00000000000000# stream-browserify the stream module from node core, for browsers! [![build status](https://secure.travis-ci.org/substack/stream-browserify.svg)](http://travis-ci.org/substack/stream-browserify) # methods Consult the node core [documentation on streams](http://nodejs.org/docs/latest/api/stream.html). # install With [npm](https://npmjs.org) do: ``` npm install stream-browserify ``` but if you are using browserify you will get this module automatically when you do `require('stream')`. # license MIT stream-browserify-2.0.1/test/000077500000000000000000000000001256745324700161745ustar00rootroot00000000000000stream-browserify-2.0.1/test/buf.js000066400000000000000000000013241256745324700173060ustar00rootroot00000000000000var path = require('path'); var test = require('tape'); var Writable = require('../').Writable; var inherits = require('inherits'); inherits(TestWritable, Writable); function TestWritable(opt) { if (!(this instanceof TestWritable)) return new TestWritable(opt); Writable.call(this, opt); this._written = []; } TestWritable.prototype._write = function(chunk, encoding, cb) { this._written.push(chunk); cb(); }; var buf = Buffer([ 88 ]); test('.writable writing ArrayBuffer', function(t) { var writable = new TestWritable(); writable.write(buf); writable.end(); t.equal(writable._written.length, 1); t.equal(writable._written[0].toString(), 'X') t.end() });