Skip to content

Commit

Permalink
file_server: get file and fileInfo concurrently (denoland/deno#3486)
Browse files Browse the repository at this point in the history
  • Loading branch information
starkwang authored and denobot committed Feb 1, 2021
1 parent 223634b commit d23341c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions http/file_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit d23341c

Please sign in to comment.