mirror of
https://github.com/denoland/deno.git
synced 2024-10-29 08:58:01 -04:00
file_server: get file and fileInfo concurrently (#3486)
This commit is contained in:
parent
7f27f649cc
commit
df7d8288d9
1 changed files with 1 additions and 2 deletions
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue