开发者社区> 镜像站> NPM> stream-spectrum
stream-spectrum
A variety of streams to be used in samples and/or tests.
Last updated 6 years ago by thlorenz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install stream-spectrum 
SYNC missed versions from official npm registry.

stream-spectrum

A variety of streams to be used in samples and/or tests.

Installation

npm install stream-spectrum

API

NumberReadable(opts) → {ReadableStream}

Generates increasing numbers between the given from and to values.

Parameters:
Name Type Description
opts Object

options

Properties
Name Type Argument Description
from Number <optional>

start value to generate

to Number <optional>

end value to generate

throttle Number <optional>

number of milliseconds to take to generate each number

Source:
Returns:

readable

Type
ReadableStream

ObjectReadable(opts) → {ReadableStream}

Generates objects with a count property that increases between the given from and to values.

Parameters:
Name Type Description
opts Object

options

Properties
Name Type Argument Description
from Number <optional>

start value to generate

to Number <optional>

end value to generate

throttle Number <optional>

number of milliseconds to take to generate each number

Source:
Returns:

readable

Type
ReadableStream

PowerTransform(opts) → {TransformStream}

Transforms numbers into the power of each number.

Parameters:
Name Type Description
opts Object

options

Properties
Name Type Argument Description
throttle Number <optional>

number of milliseconds to take to transform each number into its power

Source:
Returns:

transform

Type
TransformStream

RandomNumberReadable(opts) → {ReadableStream}

Generates random numbers between the given min and max values.

Parameters:
Name Type Description
opts Object

options

Properties
Name Type Argument Description
min Number <optional>

minimum value to generate

max Number <optional>

maximum value to generate

throttle Number <optional>

number of milliseconds to take to generate each number

Source:
Returns:

readable

Type
ReadableStream

TarpitWritable(opts) → {WritableStream}

Just drops the values written to it. Simulates processing time via throttle value

Parameters:
Name Type Description
opts Object

options

Properties
Name Type Argument Description
debug Boolean <optional>

if true written values are logged to the console

throttle Number <optional>

number of milliseconds to delay each written chunk

Source:
Returns:

writable

Type
WritableStream

generated with docme

License

MIT

Current Tags

  • 0.1.6                                ...           latest (6 years ago)

6 Versions

  • 0.1.6                                ...           6 years ago
  • 0.1.5                                ...           7 years ago
  • 0.1.4                                ...           7 years ago
  • 0.1.3                                ...           7 years ago
  • 0.1.1                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (2)