diff options
Diffstat (limited to 'cli/bench/http/deno_flash_send_file.js')
-rw-r--r-- | cli/bench/http/deno_flash_send_file.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/bench/http/deno_flash_send_file.js b/cli/bench/http/deno_flash_send_file.js new file mode 100644 index 000000000..261f5a207 --- /dev/null +++ b/cli/bench/http/deno_flash_send_file.js @@ -0,0 +1,14 @@ +// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. + +const addr = Deno.args[0] || "127.0.0.1:4500"; +const [hostname, port] = addr.split(":"); +const { serve } = Deno; + +const path = new URL("../testdata/128k.bin", import.meta.url).pathname; + +function handler() { + const file = Deno.openSync(path, { read: true }); + return new Response(file.readable); +} + +serve(handler, { hostname, port: Number(port) }); |