aboutsummaryrefslogtreecommitdiff
path: root/bench/cat/cat.mjs
blob: fc8719829153dbe703c77cc42a209863c54d5d79 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
// works in both bun & node
import { readFileSync } from "node:fs";
const count = parseInt(process.env.ITERATIONS || "1", 10) || 1;

const arg = process.argv.slice(1);

// TODO: remove Buffer.from() when readFileSync() returns Buffer

for (let i = 0; i < count; i++)
  console.log(
    arg.map((file) => Buffer.from(readFileSync(file, "utf8"))).join("")
  );