@plant/node-stream-utils

0.1.2 • Public • Published

Node Stream Utils

Utils for wrapping Node.js' stream into WebStream API and back.

Install

npm i @plant/node-stream-util

Usage

Make WebAPI Stream from Node.js':

const fs = require('fs')
const {NodeToWebStream} = require('@plant/node-stream-utils')

const webStream = new NodeToWebStream(
  fs.createReadStream(__filename)
)

Wrap WebAPI stream into Node.js':

const fs = require('fs')
const {WebToNodeStream} = require('@plant/node-stream-utils')

async function plantHandler({req}) {
  new WebToNodeStream(req.body)
  .pipe(fs.createWriteStream('index.html'))
}

License

MIT © Rumkin

/@plant/node-stream-utils/

    Package Sidebar

    Install

    npm i @plant/node-stream-utils

    Weekly Downloads

    3

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    3.01 kB

    Total Files

    4

    Last publish

    Collaborators

    • rumkin