import { stat } from "https://deno.land/x/ayonli_jsext@v0.9.72/fs.ts";
Returns the information of the given file or directory.
NOTE: This function can also be used in Cloudflare Workers.
Examples
Example 1
Example 1
// with the default storage
import { stat } from "@ayonli/jsext/fs";
const info = await stat("/path/to/file.txt");
console.log(`${info.name} is a ${info.kind}, its size is ${info.size} bytes, with MIME type ${info.type}.`);
Example 2
Example 2
// with a user-selected directory as root (Chromium only)
import { stat } from "@ayonli/jsext/fs";
const root = await window.showDirectoryPicker();
const info = await stat("/path/to/file.txt", { root });
console.log(`${info.name} is a ${info.kind}, its size is ${info.size} bytes, with MIME type ${info.type}.`);
Parameters
optional
options: StatOptions = [UNSUPPORTED]