Coder Social home page Coder Social logo

stream-browserify's Introduction

stream-browserify

the stream module from node core, for browsers!

This module uses readable-stream, with additions for compatibility with npm packages that use old Node.js stream APIs.

build status

Install

You usually do not have to install stream-browserify yourself! If your code runs in Node.js, stream is built in, or readable-stream can be used. If your code runs in the browser, bundlers like browserify also include the stream-browserify module.

But if none of those apply, with npm do:

npm install stream-browserify

API

Consult the node core documentation on streams.

Browser Support

Cross-browser testing generously provided by Sauce Labs.

Sauce Test Status

License

MIT

stream-browserify's People

Contributors

feross avatar goto-bus-stop avatar jessetane avatar max-mapper avatar rubenverborgh avatar stevemao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

stream-browserify's Issues

Update to readable-stream@3

It's holding webpack back at readable-stream@2.

Also, just genuinely curious... what is this module shimming that isn't provided by readable-stream?
I noticed this curiosity in node-libs-browser (Webpack's native Node shims):

exports.stream			= require.resolve('stream-browserify');
exports._stream_duplex		= require.resolve('readable-stream/duplex.js');
exports._stream_passthrough	= require.resolve('readable-stream/passthrough.js');
exports._stream_readable	= require.resolve('readable-stream/readable.js');
exports._stream_transform	= require.resolve('readable-stream/transform.js');
exports._stream_writable	= require.resolve('readable-stream/writable.js');

Why don't they just use

exports.stream			= require.resolve('readable-stream');

readable-stream@2 mutates core-util-is

The current used version of readable-stream (v2) mutates the exports of core-util-is.

This is likely not intentional, but the side effect of a poorly constructed polyfill

/*<replacement>*/
var util = require('core-util-is');
util.inherits = require('inherits');
/*</replacement>*/

I'm building a plugin for browserify to reduce the risk of software supplychain attacks from the dependency graph. One of its protections is that is prevents the module.exports being mutated externally.

While I have seen this pattern with modules within a package, I haven't seen this pattern across packages, with the exception of this old version of readable-stream

I have verified this is resolved in v3

Does this support React native?

ERROR TypeError: window.addEventListener is not a function. (In 'window.addEventListener("message", this._listener)', 'window.addEventListener' is undefined)
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.

stream is undefined error

Hi,

I try to use a dependency made for nodejs called tilelive. This dependency require stream.

I use browserify + gulp as my build tools but every time I launch my app and require tilelive I get :
stream is undefined error. I tried to install manually stream-browserify in my project, and also in tilelive directory, nothing works.

Any ideas ?

Thanks :)

inheritance is botched

const sb = require('stream-browserify')
const rb = new sb.Readable()
console.log(rb instanceof sb.Stream) // false

const s = require('stream')
const r = new s.Readable()
console.log(r instanceof s.Stream) // true

it's coming from readable-stream inheriting from the stream instead of stream-browserify

`stream.Writable.prototype instanceof stream` is false

Hi there,

I've found some inconsistencies around the Stream class hierarchy when running the following tests:

function assert(b) {
  if (!b) throw new Error("Assertation failed");
}

var stream = require('stream');
assert(stream.Writable.prototype instanceof stream); // OK
assert(stream.Writable.prototype instanceof stream.Stream); // OK

var stream_browserify = require('stream-browserify');
assert(stream_browserify.Writable.prototype instanceof stream_browserify); // FAIL
assert(stream_browserify.Writable.prototype instanceof stream_browserify.Stream); // FAIL

I am going to take a closer look at it in a few days, but maybe you have some idea why does it happen.

Thanks

Patch: fix buffer warnings

Could you please apply this patch:

commit 07277d8b164659247901085ab1fc63b8e18586f1 (HEAD -> patched)
Author: Bastien Roucariès <[email protected]>
Date:   Mon Jan 7 01:16:24 2019 +0100

    Fix Buffer warning

diff --git a/test/buf.js b/test/buf.js
index 8217819..d7c37eb 100644
--- a/test/buf.js
+++ b/test/buf.js
@@ -18,7 +18,7 @@ TestWritable.prototype._write = function(chunk, encoding, cb) {
     cb();
 };
 
-var buf = Buffer([ 88 ]);
+var buf = Buffer.from([ 88 ]);
 
 test('.writable writing ArrayBuffer', function(t) {
     var writable = new TestWritable();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.