UNPKG

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.

22 lines (15 loc) 469 B
import { FileSysScanHandler, FSEvent, FS_TYPE } from "../index"; async function start() { const fsScanner = new FileSysScanHandler("/Users/user/code"); fsScanner.addListener(FS_TYPE.FILE, (event: FS_TYPE) => { console.log(event); }); fsScanner.addListener(FS_TYPE.DIR, (event: FS_TYPE) => { console.log(event); }); fsScanner.addListener(FS_TYPE.ERROR, (event: string) => { console.log(event); }); fsScanner.scanIterative(); } start();