nested-input-transform-chunks.js
This file
Path
test/fixtures/nested-input-transform-chunks.js
17 lines · 484 bytes · JavaScript
Last changed by
Fix `stdin` iterables and input transforms edge casesSindre Sorhusbefore adoption6925cc3
History of this fileTake it
Fix `stdin` iterables and input transforms edge casesSindre Sorhusbefore adoption6925cc3
lines 1–17why, one step back1#!/usr/bin/env node2import process from 'node:process';3import {execa, execaSync} from '../../index.js';45// Prints the number of chunks a binary input transform receives, when `stdin` is inherited from the current process6const chunks = [];7const execaMethod = process.argv[2] === 'sync' ? execaSync : execa;8await execaMethod('stdin.js', {9 stdin: ['inherit', {10 * transform(chunk) {11 chunks.push(chunk);12 yield chunk;13 },14 binary: true,15 }],16});17console.log(chunks.length);