aboutsummaryrefslogtreecommitdiff
path: root/bench/snippets/write.node.mjs
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-09-14 21:26:37 -0700
committerGravatar GitHub <noreply@github.com> 2023-09-14 21:26:37 -0700
commitced69d38180e963da1206f9932db76666cec9f72 (patch)
treea4c4462ff8747adc7d092891b1c299dfbb0ecc4a /bench/snippets/write.node.mjs
parentb262b0153a2d9667fcb47a970e8027d3b54f8a0a (diff)
downloadbun-ced69d38180e963da1206f9932db76666cec9f72.tar.gz
bun-ced69d38180e963da1206f9932db76666cec9f72.tar.zst
bun-ced69d38180e963da1206f9932db76666cec9f72.zip
async-ify all node:fs functions (#5360)
* async all node:fs functions * draw the rest of the owl * LLVM & Clang 16 --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'bench/snippets/write.node.mjs')
-rw-r--r--bench/snippets/write.node.mjs5
1 files changed, 2 insertions, 3 deletions
diff --git a/bench/snippets/write.node.mjs b/bench/snippets/write.node.mjs
index 14bceb23f..f59c98aef 100644
--- a/bench/snippets/write.node.mjs
+++ b/bench/snippets/write.node.mjs
@@ -9,9 +9,8 @@ bench("writeFile(/tmp/foo.txt, short string)", async () => {
await writeFile("/tmp/foo.txt", "short string", "utf8");
});
-const buffer = Buffer.from("short string");
bench("writeFile(/tmp/foo.txt, Buffer.from(short string))", async () => {
- await writeFile("/tmp/foo.txt", buffer);
+ await writeFile("/tmp/foo.txt", Buffer.from("short string"));
});
const fd = openSync("/tmp/foo.txt", "w");
@@ -22,7 +21,7 @@ bench("write(fd, short string)", () => {
});
bench("write(fd, Uint8Array(short string))", () => {
- const bytesWritten = write(fd, buffer);
+ const bytesWritten = write(fd, Buffer.from("short string"));
if (bytesWritten !== 12) throw new Error("wrote !== 12");
});