diff --git a/std/http/file_server.ts b/std/http/file_server.ts index e3caae882b..40a18bd8a5 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 { - 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");