Skip to content
Myr

max-buffer.js

This file

Path

test/fixtures/max-buffer.js

13 lines · 331 bytes · JavaScript

Last changed by

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

History of this file

Take it

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

lines 1–2why, one step back
1#!/usr/bin/env node
2import process from 'node:process';

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

line 3why, one step back
3import {writeSync} from 'node:fs';

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 4why, one step back
4

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

lines 5–13why, one step back
5const index = Number(process.argv[2]);
6const bytes = '.'.repeat(Number(process.argv[3] || 1e7));7if (index === 1) {8 process.stdout.write(bytes);9} else if (index === 2) {10 process.stderr.write(bytes);11} else {12 writeSync(index, bytes);13}