@mjackson/file-storage
Version:
Key/value storage for JavaScript File objects
26 lines • 1.17 kB
TypeScript
import type { FileStorage, ListOptions, ListResult } from './file-storage.ts';
/**
* A `FileStorage` that is backed by a directory on the local filesystem.
*
* Important: No attempt is made to avoid overwriting existing files, so the directory used should
* be a new directory solely dedicated to this storage object.
*
* Note: Keys have no correlation to file names on disk, so they may be any string including
* characters that are not valid in file names. Additionally, individual `File` names have no
* correlation to names of files on disk, so multiple files with the same name may be stored in the
* same storage object.
*/
export declare class LocalFileStorage implements FileStorage {
#private;
/**
* @param directory The directory where files are stored
*/
constructor(directory: string);
get(key: string): Promise<File | null>;
has(key: string): Promise<boolean>;
list<T extends ListOptions>(options?: T): Promise<ListResult<T>>;
put(key: string, file: File): Promise<File>;
remove(key: string): Promise<void>;
set(key: string, file: File): Promise<void>;
}
//# sourceMappingURL=local-file-storage.d.ts.map