/** * @file Storage Bucket backend for {@link TinyFSCore}. * * A storage bucket is an isolated origin private file system. This backend * reuses every primitive implemented by {@link TinyOPFSFileSystem} and only * overrides how the root directory handle is resolved, so a bucket behaves * exactly like the default origin private file system. */ import TinyOPFSFileSystem from './index.mjs'; export type StorageBucketOpenOptions = { /** * Persistence guarantee requested from the browser. */ durability?: 'strict' | 'relaxed'; /** * Whether the bucket should survive eviction. */ persisted?: boolean; /** * Maximum number of bytes the bucket may use. */ quota?: number; /** * Unix timestamp, in milliseconds, after which the bucket may be cleared. */ expires?: number; }; export type StorageBucketDescriptor = { /** * Name of the storage bucket. Defaults to `'tiny-fs'`. */ name?: string; /** * Persistence guarantee requested from the browser. */ durability?: 'strict' | 'relaxed'; /** * Whether the bucket should survive eviction. */ persisted?: boolean; /** * Maximum number of bytes the bucket may use. */ quota?: number; /** * Unix timestamp, in milliseconds, after which the bucket may be cleared. */ expires?: number; }; export type StorageBucketFileSystemOptions = { /** * Working directory used to resolve relative paths. */ cwd?: string; /** * Permission mask applied on creation. */ umask?: number; /** * Effective identity used by `access`. */ identity?: import('../../index.mjs').FSIdentity; /** * Storage bucket configuration. */ bucket?: StorageBucketDescriptor; }; export type ResolvedBucketDescriptor = { /** * Validated bucket name. */ name: string; /** * Validated bucket options. */ options: StorageBucketOpenOptions; }; /** * Origin Private File System backend scoped to a single storage bucket. * * @beta */ declare class TinyStorageBucketFileSystem extends TinyOPFSFileSystem { #private; /** * @param {StorageBucketFileSystemOptions} [options] Construction options. * @throws {TypeError} When the `bucket` option is malformed. * @throws {RangeError} When a numeric bucket option is negative. */ constructor(options?: StorageBucketFileSystemOptions); /** * @returns {boolean} `true` when the Storage Buckets API is available. */ static get isSupported(): boolean; /** * Lists the names of every storage bucket owned by the origin. * * @returns {Promise} The bucket names. * @throws {Error} When the Storage Buckets API is not available. */ static listBuckets(): Promise; /** * Deletes a storage bucket owned by the origin. * * @param {string} name Name of the bucket to delete. * @returns {Promise} `true` when the bucket existed. * @throws {TypeError} When `name` is not a non-empty string. * @throws {Error} When the Storage Buckets API is not available. */ static deleteBucket(name: string): Promise; /** @returns {string} Name of the storage bucket backing this instance. */ get bucketName(): string; /** * @override * @returns {Promise} The bucket root directory. * @throws {Error} When the Storage Buckets API is not available. */ _resolveRoot(): Promise; } export default TinyStorageBucketFileSystem; //# sourceMappingURL=StorageBucket.d.mts.map