Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Stream string
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
example
test
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

stread - stream string

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

Build Status

Usage

Pipe

var stread = require('stread')

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

Read 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()

API

stread(str)

  • str The String to stream

Returns a Readable stream.

Installation

With npm do:

$ npm install stread

License

MIT License

Something went wrong with that request. Please try again.