From 4c0145437679f879329df69c9a56e395e74e8280 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Wed, 31 May 2023 17:20:30 -0700 Subject: Make uploading files with `fetch()`fast (#3125) * Make file uploads fast * Add benchmark * Update README.md * defaults * print * prettier * smaller * fix(path) fix parse behavior (#3134) * Add macro docs (#3139) * Add macro doc * Updates * Tweaks * Update doc * Update macro serialization doc * Update macro doc * `--no-macros` flag, disable macros in node_modules * invert base/filename internally (#3141) * always false * Fix broken test * Add a test sendfile() test with large file --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: Ciro Spaciari Co-authored-by: Colin McDonnell --- bench/stream-file-upload-client/stream-file-bun.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 bench/stream-file-upload-client/stream-file-bun.js (limited to 'bench/stream-file-upload-client/stream-file-bun.js') diff --git a/bench/stream-file-upload-client/stream-file-bun.js b/bench/stream-file-upload-client/stream-file-bun.js new file mode 100644 index 000000000..e3499bd29 --- /dev/null +++ b/bench/stream-file-upload-client/stream-file-bun.js @@ -0,0 +1,9 @@ +import { file } from "bun"; +console.time("stream-file-bun"); +const response = await fetch(process.env.URL ?? "http://localhost:3000", { + method: "POST", + body: file(process.env.FILE ?? "hello.txt"), +}); +console.timeEnd("stream-file-bun"); + +console.log("Sent", await response.text(), "bytes"); -- cgit v1.2.3