@zenfs/core
Version:
A filesystem, anywhere
49 lines (48 loc) • 1.37 kB
TypeScript
import { Stats, type StatsLike } from './stats.js';
/**
* Alias for an ino.
* This will be helpful if in the future inode numbers/IDs are changed to strings or numbers.
*/
export type Ino = bigint;
/**
* Room inode
* @hidden
*/
export declare const rootIno = 0n;
/**
* Generate a random ino
* @internal
*/
export declare function randomIno(): Ino;
/**
* Generic inode definition that can easily be serialized.
*/
export declare class Inode implements StatsLike {
get data(): Uint8Array;
constructor(buffer?: ArrayBufferLike);
ino: Ino;
size: number;
mode: number;
nlink: number;
uid: number;
gid: number;
atimeMs: number;
birthtimeMs: number;
mtimeMs: number;
ctimeMs: number;
/**
* Handy function that converts the Inode to a Node Stats object.
*/
toStats(): Stats;
/**
* Updates the Inode using information from the stats object. Used by file
* systems at sync time, e.g.:
* - Program opens file and gets a File object.
* - Program mutates file. File object is responsible for maintaining
* metadata changes locally -- typically in a Stats object.
* - Program closes file. File object's metadata changes are synced with the
* file system.
* @return True if any changes have occurred.
*/
update(stats: Readonly<Stats>): boolean;
}