summaryrefslogtreecommitdiff
path: root/std/http/file_server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/http/file_server.ts')
-rwxr-xr-xstd/http/file_server.ts3
1 files changed, 1 insertions, 2 deletions
diff --git a/std/http/file_server.ts b/std/http/file_server.ts
index e3caae882..40a18bd8a 100755
--- a/std/http/file_server.ts
+++ b/std/http/file_server.ts
@@ -82,8 +82,7 @@ async function serveFile(
req: ServerRequest,
filePath: string
): Promise<Response> {
- const file = await open(filePath);
- const fileInfo = await stat(filePath);
+ const [file, fileInfo] = await Promise.all([open(filePath), stat(filePath)]);
const headers = new Headers();
headers.set("content-length", fileInfo.len.toString());
headers.set("content-type", "text/plain");