Stream transformation for Node.js
This project provides a simple object transformation framework implementing the Node.js stream.Transform
API. Transformations are based on a user handler function that must be provided. It was originally developed as a part of the Node.js CSV package (npm install csv
) and can be used independently.
Source code for this project is available on GitHub.
Main features
- Extends the native Node.js transform stream API
- Simplicity with the optional callback and sync API
- Pipe transformations between readable and writable streams
- Synchronous versus asynchronous user functions
- Sequential and parallel execution
- Accept object, array or JSON as input and output
- Sequential or user-defined concurrent execution
- Skip and multiply records
- Alter or clone input records
- Work nicely with the csv-generate, csv-parse and csv-stringify packages
- MIT License
Usage
Run npm install csv
to install the full CSV module or run npm install stream-transform
if you are only interested by this package.
The source code uses modern JavaScript features and run natively in Node 7.6+. For older browsers or older versions of Node, use the modules inside "./lib/es5".
Data is expected to be an array of records. Records may be provided in any form such as a string, an array or an object. Options can be placed in any positions.
Additional help
For usage and examples, you may refer to the "samples" folder and the "test" folder.