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 🙏

© 2025 – Pkg Stats / Ryan Hefner

stread

v3.0.1

Published

stream string

Downloads

28

Readme

stread - stream string

The stread Node.js module makes an utf-8 encoded string readable through the stream API, which can be handy sometimes, while writing tests for streams, for example.

Build Status

Why not use PassThrough?

stread is more than 2x faster than PassThrough:

$ node benchmark.js

Working...

  12 tests completed.

  stread 10           x 57,941 ops/sec ±1.85% (168 runs sampled)
  PassThrough 10      x 26,209 ops/sec ±1.68% (172 runs sampled)
  stread 100          x 57,693 ops/sec ±1.46% (172 runs sampled)
  PassThrough 100     x 26,877 ops/sec ±1.39% (172 runs sampled)
  stread 1024         x 53,571 ops/sec ±1.25% (172 runs sampled)
  PassThrough 1024    x 24,631 ops/sec ±1.66% (171 runs sampled)
  stread 10240        x 30,416 ops/sec ±1.21% (171 runs sampled)
  PassThrough 10240   x 18,464 ops/sec ±1.67% (166 runs sampled)
  stread 102400       x  7,676 ops/sec ±1.63% (159 runs sampled)
  PassThrough 102400  x  7,929 ops/sec ±1.27% (171 runs sampled)
  stread 1024000      x    908 ops/sec ±1.10% (167 runs sampled)
  PassThrough 1024000 x    552 ops/sec ±1.47% (171 runs sampled)

Example

Piping to a writable stream

var stread = require('stread')

stread('You know what it is to be born alone, Baby tortoise!')
  .pipe(process.stdout)

Reading one octet at a time

var stread = require('stread')

var reader = stread('You know what it is to be born alone, Baby tortoise!')
var writer = process.stdout

function write () {
  var ok
  var chunk
  do {
    if ((chunk = reader.read(1)) !== null) {
      ok = writer.write(chunk)
    }
  } while (chunk && ok)
  if (!ok) writer.once('drain', write)
}

write()

Exports

function stread(str)
  • str The String to stream.

Returns a Readable stream.

Installation

With npm, do:

$ npm install stread

License

MIT License