Skip to content

size

Module @netwiv/api/plugins/fs · Kind Function

import { size } from '@netwiv/api/plugins/fs';

Get the size of a file or directory. For files, the stat functions can be used as well.

If path is a directory, this function will recursively iterate over every file and every directory inside of path and therefore will be very time consuming if used on larger directories.

function size(path: string | URL): Promise<number>
import { size, BaseDirectory } from '@netwiv/api/plugins/fs';
// Get the size of the `$APPDATA/tauri` directory.
const dirSize = await size('tauri', { baseDir: BaseDirectory.AppData });
console.log(dirSize); // 1024

Upstream since 2.1.0


Descriptions come from the pinned @tauri-apps/plugin-fs@2.5.2 declarations (MIT OR Apache-2.0); imports are shown with @netwiv/api paths.