Skip to content

DataAdapter.stat method

DataAdapter › stat

Official

Retrieve metadata about the given file/folder.

Signature:

stat(normalizedPath: string): Promise<Stat | null>

Parameters:

ParameterTypeDescription
normalizedPathstringpath to file/folder, use {@link normalizePath} to normalize beforehand.

Returns: Promise<Stat | null> — The metadata, or null if nothing exists at the path.

Since: 0.12.2

Example:

const stat = await adapter.stat(path);
if (stat?.type === 'file') {
console.log(stat.size, stat.mtime);
}