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
123456789101112131415161718#!/usr/bin/env nodeimport process from 'node:process';import {execa, execaSync} from '../../index.js';
// Prints the number of chunks a binary input transform receives, when `stdin` is inherited from the current processconst chunks = [];const execaMethod = process.argv[2] === 'sync' ? execaSync : execa;await execaMethod('stdin.js', { stdin: ['inherit', { * transform(chunk) { chunks.push(chunk); yield chunk; }, binary: true, }],});console.log(chunks.length);