2024-05-09 22:21:15 +00:00
|
|
|
import Stream from 'stream'
|
|
|
|
|
2024-05-10 20:04:09 +00:00
|
|
|
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)
|