Fix demo
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import type { FileMeta } from "../common/types.ts";
|
||||
|
||||
import { walk } from "https://deno.land/std@0.159.0/fs/mod.ts";
|
||||
import { resolve } from "https://deno.land/std@0.159.0/path/mod.ts";
|
||||
import { mime } from "https://deno.land/x/mimetypes@v1.0.0/mod.ts";
|
||||
|
||||
const rootDir = resolve("website_build/fs");
|
||||
|
||||
const allFiles: FileMeta[] = [];
|
||||
for await (
|
||||
const file of walk(rootDir, {
|
||||
includeDirs: false,
|
||||
// Exclude hidden files
|
||||
skip: [/^.*\/\..+$/],
|
||||
})
|
||||
) {
|
||||
const fullPath = file.path;
|
||||
const s = await Deno.stat(fullPath);
|
||||
allFiles.push({
|
||||
name: fullPath.substring(rootDir.length + 1),
|
||||
lastModified: s.mtime!.getTime(),
|
||||
contentType: mime.getType(fullPath) || "application/octet-stream",
|
||||
size: s.size,
|
||||
perm: "rw",
|
||||
});
|
||||
}
|
||||
console.log(JSON.stringify(allFiles, null, 2));
|
||||
Reference in New Issue
Block a user