mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-21 05:50:55 +08:00
- Preserve callable properties, descriptors, and shared module bindings across native JavaScript code. - Add stored process streams with input control, output callbacks, and write interception. - Preserve Error identity and classification through native rethrows and promise rejection.
15 lines
386 B
JavaScript
15 lines
386 B
JavaScript
const input = process.stdin;
|
|
input.pause();
|
|
console.log('initial', input.read() === null);
|
|
let text = '';
|
|
let polls = 0;
|
|
const timer = setInterval(() => {
|
|
let chunk;
|
|
while ((chunk = input.read()) !== null) text += String(chunk);
|
|
if (text === 'hello' || ++polls > 100) {
|
|
clearInterval(timer);
|
|
input.pause();
|
|
console.log('read', text, input.readableLength);
|
|
}
|
|
}, 10);
|