aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/stdio-test-instance-a-lot.js
blob: 2b65d786cc37a67663521706d4c914b0479d66b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { ArrayBufferSink } from "bun";

const sink = new ArrayBufferSink();

sink.write("hello");
sink.write(" ");
sink.write("world");
sink.write(new TextEncoder().encode("hello again|"));
sink.write(
  new TextEncoder().encode(
    "😋 Get Emoji — All Emojis to ✂️ Copy and 📋 Paste 👌",
  ),
);

const string = Buffer.from(sink.end()).toString().repeat(9999);

if (process.env.TEST_STDIO_STRING) {
  const result = string;
  process.stdout.write(result);
} else {
  const result = Buffer.from(string);
  process.stdout.write(result);
}