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

from2-array

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

from2-array

Create a from2 stream based on an array of source values

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is from2-array?

The from2-array npm package is a utility that allows you to create a readable stream from an array of values. This can be particularly useful for testing, prototyping, or when you need to convert an array into a stream for further processing.

What are from2-array's main functionalities?

Create a readable stream from an array

This feature allows you to create a readable stream from an array of values. The stream emits each value in the array as a chunk of data.

const from2Array = require('from2-array');
const stream = from2Array(['a', 'b', 'c']);
stream.on('data', (chunk) => {
  console.log(chunk.toString());
});

Create a readable stream from an array with a custom read function

This feature allows you to create a readable stream from an array with a custom read function. The custom read function can be used to control how data is read from the array.

const from2Array = require('from2-array');
const stream = from2Array.obj(['a', 'b', 'c'], (size, next) => {
  next(null, this.values.shift() || null);
});
stream.on('data', (chunk) => {
  console.log(chunk);
});

Other packages similar to from2-array

Keywords

FAQs

Package last updated on 06 Jul 2015

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