jvilk / BrowserFS

BrowserFS is an in-browser filesystem that emulates the Node JS filesystem API and supports storing and retrieving files from various backends.
Other
3.06k stars 216 forks source link

Add metadata to `FileSystem` #374

Closed james-pre closed 9 months ago

james-pre commented 9 months ago

Instead of using many different functions for checking metadata about a FileSystem, it would be cleaner and more organized to use a metadata property. For example:

export interface FileSystemMetadata {
    name: string;
    readonly: boolean;
    synchronous: boolean;
    supportsProperties: boolean;
    supportsLinks: boolean;
    totalSpace: number;
    freeSpace: number;
}

export abstract class FileSystem {
    abstract readonly metadata: FileSystemMetadata;
}

Implementations would use getters or readonly to ensure that users can not modify the file system's metadata.

james-pre commented 9 months ago

Added in 4f6ce99