Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stream-from-to

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-from-to

Utility for piping to/from a stream from a variety of sources to a variety of destinations

  • 1.4.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.1K
increased by17.41%
Maintainers
1
Weekly downloads
 
Created
Source

stream-from-to Build Status Dependency Status

Utility for piping to/from a stream from a variety of sources to a variety of destinations.

Pass stream-from-to a function that creates a through stream and it'll give you back an object that simplifies the constructon of source and destination streams for piping to/from the through stream.

Usage examples

var streamft = require("stream-from-to")
  , through = require("through")

var mdToHtml = function (filePath) {
  // Through stream that converts markdown to HTML
  return through()
}

streamft(mdToHtml).from.path("/path/to/doc.md").to.path("/path/to/doc.html", function (er) {
    if (er) return console.error(er)
    // Done!
})

With brfs:

var streamft = require("stream-from-to")
  , brfs = require("brfs")

streamft(brfs).from("src/index.js").to("dist/index.js")

API

from.path(path, opts)

Create a readable stream from path and pipe to the through stream. path can be a single path or array of paths.

from.string(string)

Create a readable stream from string and pipe to the through stream. string can be a single string or array of strings.

concat.from.paths(paths, opts)

Create and concatinate readable streams from paths and pipe to the through stream.

concat.from.strings(strings, opts)

Create and concatinate readable streams from strings and pipe to the through stream.

to.path(path, cb)

Create a writeable stream to path and pipe output from the through stream to it. path can be a single path, or array of output paths if you specified an array of inputs. The callback function cb will be invoked when data has finished being written.

to.buffer(opts, cb)

Create a concat-stream and pipe output from the through stream to it. The callback function cb will be invoked when the buffer has been created.

to.string(opts, cb)

Create a concat-stream and pipe output from the through stream to it. The callback function cb will be invoked when the string has been created.

FAQs

Package last updated on 20 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc