Socket
Socket
Sign inDemoInstall

extend-stream

Package Overview
Dependencies
2
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    extend-stream

A stream that extends JSON objects with JSON objects


Version published
Maintainers
1
Install size
24.5 kB
Created

Readme

Source

Extend Stream

Extend stream is a stream that takes an initial JSON object and extends it with other JSON objects it receives and emits the final result when it's read source is done streaming objects to it

var extendStream = require("extend-stream");
var JSONStream   = require("JSONStream");
var eventStream  = require("event-stream");

obj = {
  run: "don't",
  walk: "to",
  the: "party"
}

var lineStream = eventStream(function(line, next) {
  next(false, line + "\n");
});

stream = extendStream(obj);

stream.pipe(JSONStream.stringify(false)).pipe(lineStream).pipe(process.stdout)

stream.write({ run: "fast don't" })
stream.write({ the: "awesome party" })
stream.end()

extendStream(init)

Extend stream exports a single function extendStream. This function takes only one argument, which is the initial object value to extend.

  • @param {object} init - The initial object to extend
  • @returns {stream}

Keywords

FAQs

Last updated on 06 Oct 2012

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc