summaryrefslogtreecommitdiffstats
path: root/node_modules/stream-browserify
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/stream-browserify')
-rw-r--r--node_modules/stream-browserify/.travis.yml16
-rw-r--r--node_modules/stream-browserify/LICENSE20
-rw-r--r--node_modules/stream-browserify/index.js127
-rw-r--r--node_modules/stream-browserify/package.json80
-rw-r--r--node_modules/stream-browserify/readme.markdown25
-rw-r--r--node_modules/stream-browserify/test/buf.js33
6 files changed, 301 insertions, 0 deletions
diff --git a/node_modules/stream-browserify/.travis.yml b/node_modules/stream-browserify/.travis.yml
new file mode 100644
index 0000000..8e536f4
--- /dev/null
+++ b/node_modules/stream-browserify/.travis.yml
@@ -0,0 +1,16 @@
+sudo: false
+language: node_js
+node_js:
+ - 'stable'
+ - '10'
+ - '9'
+ - '8'
+ - '6'
+ - '4'
+ - '0.12'
+ - '0.10'
+ - '0.8'
+before_install:
+ # Old npm certs are untrusted https://github.com/npm/npm/issues/20191
+ - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ] || [ "${TRAVIS_NODE_VERSION}" = "0.8" ]; then export NPM_CONFIG_STRICT_SSL=false; fi'
+ - 'nvm install-latest-npm'
diff --git a/node_modules/stream-browserify/LICENSE b/node_modules/stream-browserify/LICENSE
new file mode 100644
index 0000000..e45bc69
--- /dev/null
+++ b/node_modules/stream-browserify/LICENSE
@@ -0,0 +1,20 @@
+This software is released under the MIT license:
+
+Copyright (c) James Halliday
+
+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.
diff --git a/node_modules/stream-browserify/index.js b/node_modules/stream-browserify/index.js
new file mode 100644
index 0000000..8d6a13a
--- /dev/null
+++ b/node_modules/stream-browserify/index.js
@@ -0,0 +1,127 @@
+// 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;
+};
diff --git a/node_modules/stream-browserify/package.json b/node_modules/stream-browserify/package.json
new file mode 100644
index 0000000..ab3ac6a
--- /dev/null
+++ b/node_modules/stream-browserify/package.json
@@ -0,0 +1,80 @@
+{
+ "_from": "stream-browserify@^2.0.1",
+ "_id": "stream-browserify@2.0.2",
+ "_inBundle": false,
+ "_integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==",
+ "_location": "/stream-browserify",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "stream-browserify@^2.0.1",
+ "name": "stream-browserify",
+ "escapedName": "stream-browserify",
+ "rawSpec": "^2.0.1",
+ "saveSpec": null,
+ "fetchSpec": "^2.0.1"
+ },
+ "_requiredBy": [
+ "/node-libs-browser"
+ ],
+ "_resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz",
+ "_shasum": "87521d38a44aa7ee91ce1cd2a47df0cb49dd660b",
+ "_spec": "stream-browserify@^2.0.1",
+ "_where": "/home/pruss/Dev/3-minute-website/node_modules/node-libs-browser",
+ "author": {
+ "name": "James Halliday",
+ "email": "mail@substack.net",
+ "url": "http://substack.net"
+ },
+ "bugs": {
+ "url": "https://github.com/browserify/stream-browserify/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "inherits": "~2.0.1",
+ "readable-stream": "^2.0.2"
+ },
+ "deprecated": false,
+ "description": "the stream module from node core for browsers",
+ "devDependencies": {
+ "safe-buffer": "^5.1.2",
+ "tape": "^4.2.0",
+ "typedarray": "~0.0.6"
+ },
+ "homepage": "https://github.com/browserify/stream-browserify",
+ "keywords": [
+ "stream",
+ "browser",
+ "browserify"
+ ],
+ "license": "MIT",
+ "main": "index.js",
+ "name": "stream-browserify",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/browserify/stream-browserify.git"
+ },
+ "scripts": {
+ "test": "tape test/*.js"
+ },
+ "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"
+ ]
+ },
+ "version": "2.0.2"
+}
diff --git a/node_modules/stream-browserify/readme.markdown b/node_modules/stream-browserify/readme.markdown
new file mode 100644
index 0000000..f89dd73
--- /dev/null
+++ b/node_modules/stream-browserify/readme.markdown
@@ -0,0 +1,25 @@
+# stream-browserify
+
+the stream module from node core, for browsers!
+
+[![build status](https://secure.travis-ci.org/browserify/stream-browserify.svg)](http://travis-ci.org/browserify/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
diff --git a/node_modules/stream-browserify/test/buf.js b/node_modules/stream-browserify/test/buf.js
new file mode 100644
index 0000000..95f7772
--- /dev/null
+++ b/node_modules/stream-browserify/test/buf.js
@@ -0,0 +1,33 @@
+var path = require('path');
+var test = require('tape');
+var Buffer = require('safe-buffer').Buffer;
+
+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.from([ 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()
+});