summaryrefslogtreecommitdiff
path: root/std/http/file_server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/http/file_server.ts')
-rwxr-xr-xstd/http/file_server.ts20
1 files changed, 11 insertions, 9 deletions
diff --git a/std/http/file_server.ts b/std/http/file_server.ts
index a66118e74..ffcf31e54 100755
--- a/std/http/file_server.ts
+++ b/std/http/file_server.ts
@@ -97,7 +97,7 @@ function fileLenToString(len: number): string {
export async function serveFile(
req: ServerRequest,
- filePath: string
+ filePath: string,
): Promise<Response> {
const [file, fileInfo] = await Promise.all([
Deno.open(filePath),
@@ -122,7 +122,7 @@ export async function serveFile(
// TODO: simplify this after deno.stat and deno.readDir are fixed
async function serveDir(
req: ServerRequest,
- dirPath: string
+ dirPath: string,
): Promise<Response> {
const dirUrl = `/${posix.relative(target, dirPath)}`;
const listEntry: EntryInfo[] = [];
@@ -192,7 +192,7 @@ function setCORS(res: Response): void {
res.headers.append("access-control-allow-origin", "*");
res.headers.append(
"access-control-allow-headers",
- "Origin, X-Requested-With, Content-Type, Accept, Range"
+ "Origin, X-Requested-With, Content-Type, Accept, Range",
);
}
@@ -263,9 +263,10 @@ function dirViewerTemplate(dirname: string, entries: EntryInfo[]): string {
<th>Size</th>
<th>Name</th>
</tr>
- ${entries.map(
- (entry) =>
- html`
+ ${
+ entries.map(
+ (entry) =>
+ html`
<tr>
<td class="mode">
${entry.mode}
@@ -277,8 +278,9 @@ function dirViewerTemplate(dirname: string, entries: EntryInfo[]): string {
<a href="${entry.url}">${entry.name}</a>
</td>
</tr>
- `
- )}
+ `,
+ )
+ }
</table>
</main>
</body>
@@ -359,7 +361,7 @@ function main(): void {
console.error(e.message);
}
}
- }
+ },
);
console.log(`HTTP server listening on http://${addr}/`);