vmind_dir_scan
Version:
A library to scan the file system based on a root folder. The library will scan recursively and send a callback for every file and directory it finds, including details such as age, name, path, and size.
19 lines (15 loc) • 501 B
text/typescript
import { z } from "zod";
const fsEventSchema = z.object({
name: z.string().describe("file or dir name"),
path: z.string().describe("full path"),
type: z.string().describe("file or dir type"),
ageInSeconds: z.number().describe("age of file in seconds"),
ageInDays: z.number().describe("age of file in days"),
size: z.number().describe("file size in MB"),
});
export type FSEvent = z.infer<typeof fsEventSchema>;
export enum FS_TYPE {
FILE = "file",
DIR = "dir",
ERROR = "error",
}