A nodeJS through2 transform stream that splits incoming arrays, emitting each array entry as a separate data event.
npm install array-split-stream
var splitter = require('array-split-stream')()
splitter.on('data', function(entry) {
console.log('entry:', entry)
})
splitter.on('end', function() {
console.log('done')
})
splitter.write([1, 2, 3])
splitter.write(['orange', 'apple', 'tomato'])
splitter.end()
// entry: 1
// entry: 2
// entry: 3
// entry: orange
// entry: apple
// entry: tomato
// done
To the extent possible by law, we transfer any rights we have in this code to the public domain. Specifically, we do so using the CC0 1.0 Universal Public Domain Dedication.
You can do whatever you want with this code. No need to credit us, link to us, include any license, or anything else. But if you want to do those things, you're free to do that too.