JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 114084718
  • Score
    100M100P100Q241787F
  • License MIT

Get a stream as a string or buffer

Package Exports

  • get-stream

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (get-stream) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

get-stream Build Status

Get a stream as a string or buffer

Install

$ npm install --save get-stream

Usage

const fs = require('fs');
const getStream = require('get-stream');
const stream = fs.createReadStream('unicorn.txt');

getStream(stream).then(str => {
    console.log(str);
    /*
                  ,,))))))));,
               __)))))))))))))),
    \|/       -\(((((''''((((((((.
    -*-==//////((''  .     `)))))),
    /|\      ))| o    ;-.    '(((((                                  ,(,
             ( `|    /  )    ;))))'                               ,_))^;(~
                |   |   |   ,))((((_     _____------~~~-.        %,;(;(>';'~
                o_);   ;    )))(((` ~---~  `::           \      %%~~)(v;(`('~
                      ;    ''''````         `:       `:::|\,__,%%    );`'; ~
                     |   _                )     /      `:|`----'     `-'
               ______/\/~    |                 /        /
             /~;;.____/;;'  /          ___--,-(   `;;;/
            / //  _;______;'------~~~~~    /;;/\    /
           //  | |                        / ;   \;;,\
          (<_  | ;                      /',/-----'  _>
           \_| ||_                     //~;~~~~~~~~~
               `\_|                   (,~~
                                       \~\
                                        ~~
    */
});

API

Both methods returns a promise that is resolved when the end event fires on the stream, indicating that there is no more data to be read.

getStream(stream)

Get the stream as a string.

getStream.buffer(stream)

Get the stream as a buffer.

  • get-stdin - Get stdin as a string or buffer

License

MIT © Sindre Sorhus