purescript-node-stream-pipes/test/Test/Pipes.Node.Stream.js

20 lines
477 B
JavaScript
Raw Normal View History

2024-05-09 22:21:15 +00:00
import Stream from 'stream'
export const discardTransform = () => new Stream.Transform({
transform: function(_ck, _enc, cb) {
cb()
},
objectMode: true
})
export const charsTransform = () => new Stream.Transform({
transform: function(ck, _enc, cb) {
ck.split('').filter(s => !!s).forEach(s => this.push(s))
cb()
},
objectMode: true,
})
2024-05-09 22:21:15 +00:00
/** @type {(a: Array<unknown>) => Stream.Readable}*/
export const readableFromArray = a => Stream.Readable.from(a)