add.js
This file
Path
lib/convert/add.js
19 lines · 1.2 KiB · JavaScript
Last changed by
Add `.readableStream()`, `.writableStream()` and `.transformStream()` methods (#1254)Sindre Sorhusbefore adoption29d9cfc
History of this fileTake it
The walk stopped after 200 commits: lines older than 9f65b86 point at it.
100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 1–4why, one step back1import {initializeConcurrentStreams} from './concurrent.js';2import {createReadable} from './readable.js';3import {createWritable} from './writable.js';4import {createDuplex} from './duplex.js';Add `.readableStream()`, `.writableStream()` and `.transformStream()` methods (#1254)Sindre Sorhusbefore adoption29d9cfc
line 5why, one step back5import {createReadableStream, createWritableStream, createTransformStream} from './web.js';100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 6–13why, one step back6import {createIterable} from './iterable.js';78// Add methods to convert the subprocess to a stream or iterable9export const addConvertedStreams = (subprocess, {encoding}) => {10 const concurrentStreams = initializeConcurrentStreams();11 subprocess.readable = createReadable.bind(undefined, {subprocess, concurrentStreams, encoding});12 subprocess.writable = createWritable.bind(undefined, {subprocess, concurrentStreams});13 subprocess.duplex = createDuplex.bind(undefined, {subprocess, concurrentStreams, encoding});Add `.readableStream()`, `.writableStream()` and `.transformStream()` methods (#1254)Sindre Sorhusbefore adoption29d9cfc
lines 14–16why, one step back14 subprocess.readableStream = createReadableStream.bind(undefined, subprocess);15 subprocess.writableStream = createWritableStream.bind(undefined, subprocess);16 subprocess.transformStream = createTransformStream.bind(undefined, subprocess);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 17–19why, one step back17 subprocess.iterable = createIterable.bind(undefined, subprocess, encoding);18 subprocess[Symbol.asyncIterator] = createIterable.bind(undefined, subprocess, encoding, {});19};