stream-to-string
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

stream-to-string

NPM version Build Status Coverage Status

Pipe a stream into a string, collect value with callback or promise

example

var toString = require('..'),
    through2 = require('through2'),
    stream   = through2()

toString(stream, function (err, msg) {
    console.log(msg)
})

# or with promises
toString(stream).then(function (msg) {
    console.log(msg)
})

stream.write('this is a')
stream.write(' test')
stream.end()

api

var toString = require('stream-to-string')

toString(stream[, enc][, cb])

Collects stream data into a string. Accepts an optional encoding argument used when converting the stream. Executes optional callback with err, string. Returns a promise.

testing

npm test [--dot | --spec] [--coverage | --grep=pattern]

Specifying --dot or --spec will change the output from the default TAP style. Specifying --coverage will print a text coverage summary to the terminal after tests have ran, while --pattern will only run the test files that match the given pattern.

Open an html coverage report with npm run view-cover.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.2.1
    27,998
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.2.1
    27,998
  • 1.2.0
    67,796
  • 1.1.0
    2,855
  • 1.0.1
    1
  • 1.0.0
    0

Package Sidebar

Install

npm i stream-to-string

Weekly Downloads

76,492

Version

1.2.1

License

MIT

Unpacked Size

10.7 kB

Total Files

16

Last publish

Collaborators

  • jasonpincin