npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

stream-browser

v1.2.0

Published

A the stream module from node

Downloads

38

Readme

Stream browser

The stream module from nodejs v22.6.0, created as a polyfill for browsers. ( Also includes EventEmitter because stream uses it and a fs noop )

Notes: requires a buffer polyfill to be in use and does NOT support webstreams

How to use on nodejs

Possibly as a polyfill for old nodejs versions?
const stream = require("stream-browser");
// OR
import stream from "stream-browser";
// Or even
import promises from "stream-browser/promises";
// However you want to use streams

How to use with webpack

Include in your config file:

Commonjs

module.exports = {
  resolve: {
    fallback: {
      stream: require.resolve("stream-browser"),
      events: require.resolve("stream-browser/extras/events")
    }
  }
}

Esm

import { fileURLToPath } from "url";
/**
 * Resolve a module
 * @param {string} specifier 
 */
function resolve(specifier){
  return fileURLToPath(import.meta.resolve(specifier));
}
export default {
  resolve: {
    fallback: {
      stream: resolve("stream-browser"),
      events: resolve("stream-browser/extras/events")
    }
  }
}

Enabling debug

To enable debug, before using any part of this module ( With the exception of the fs noop ), run

require("stream-browser/loader.js")(/*Debug settings string here*/);

If you enable all debug (By provideing "*"), you will see something like this:

INTERNALBINDING (PATCH) 3056: binding trace_events not found
INTERNALBINDING (PATCH) 3056: attempted to acess nonexsistent prop NODE_PERFORMANCE_MILESTONE_TIME_ORIGIN of binding performance.constants, returning blank proxy.
INTERNALBINDING (PATCH) 3056: attempted to acess nonexsistent prop NODE_PERFORMANCE_MILESTONE_TIME_ORIGIN_TIMESTAMP of binding performance.constants, returning blank proxy.
STREAM 3056: push <Buffer 62 6f 63 6b>
STREAM 3056: read undefined
STREAM 3056: need readable false
STREAM 3056: length less than watermark true
STREAM 3056: do read

The INTERNALBINDING messages are COMPLETELY normal ( They happen because I did not fully tree-shake so there is code that is never used but needs a binding that I did not polyfill because IT WON'T EVER GET USED. )

If you try to enable debug AFTER this polyfill gets used, you will see a mesage like this: