diff options
-rwxr-xr-x | std/http/file_server.ts | 3 |
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"); |