Skip to content

Commit

Permalink
file_server: get file and fileInfo concurrently (denoland#3486)
Browse files Browse the repository at this point in the history
  • Loading branch information
starkwang authored and ry committed Dec 12, 2019
1 parent 7f27f64 commit df7d828
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions std/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 df7d828

Please sign in to comment.