1.0.2 • Published 2 years ago

from2-error v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

CI Coverage Status

NPM

from2-error

Create a stream that immediately emits the specified Error. Sugary wrapper around from2.

Useful when you want to create a Stream for unit testing your error handlers.

Example

const from = require('from-error');
const through = require('through2');

from(new Error('Test error'))
  .on('error', err => {
    // Handle the error here
  })
  .on('data', () => {
    // This will never run
  })
  .on('end', () => {
    // This will never run
  })
  .on('close', () => {
    // This will emit when the stream is done
  });

Testing

npm test

License

MIT

1.0.2

2 years ago

1.0.1

3 years ago

1.0.0

7 years ago

0.1.0

7 years ago