StorageBucket Class

A storage bucket (https://wicg.github.io/storage-buckets/#storagebucket): the IndexedDB databases (StorageBucket.IndexedDB), the caches and the origin private file system (StorageBucket.GetDirectory) of a named bucket of the origin, with its persistence, its quota and its expiration time. Once the bucket is deleted, the methods fail with an UnknownError DomException.

public sealed class StorageBucket

Properties

NameDescription
IndexedDBGets the IndexedDB databases of the bucket.
NameGets the name of the bucket.

Gets the IndexedDB databases of the bucket.

public IdbFactory IndexedDB { get; }

Gets the name of the bucket.

public string Name { get; }

Methods

NameDescription
Estimate()Returns an estimation of the usage of the bucket (its databases, caches and file system) and its quota: the quota of the bucket, or the quota of the origin (StorageOptions.Quota).
Expires()Returns the expiration time of the bucket, in milliseconds since the Unix epoch, or null (https://wicg.github.io/storage-buckets/#dom-storagebucket-expires).
GetDirectory()Returns the root directory of the origin private file system of the bucket (https://wicg.github.io/storage-buckets/#dom-storagebucket-getdirectory), whose writes are limited by the quota of the bucket. The task fails with an InvalidStateError once the bucket is deleted (as in Chromium).
Persist()Requests the bucket to be persistent (https://wicg.github.io/storage-buckets/#dom-storagebucket-persist), as StorageManager.Persist, and returns whether it is.
Persisted()Returns whether the bucket is persistent (https://wicg.github.io/storage-buckets/#dom-storagebucket-persisted).
SetExpires(double)Sets the expiration time of the bucket, in milliseconds since the Unix epoch (https://wicg.github.io/storage-buckets/#dom-storagebucket-setexpires).

Returns an estimation of the usage of the bucket (its databases, caches and file system) and its quota: the quota of the bucket, or the quota of the origin (StorageOptions.Quota).

public Task<StorageEstimate> Estimate()

Returns the expiration time of the bucket, in milliseconds since the Unix epoch, or null (https://wicg.github.io/storage-buckets/#dom-storagebucket-expires).

public Task<double?> Expires()

GetDirectory()

StorageBuckets.cs

Returns the root directory of the origin private file system of the bucket (https://wicg.github.io/storage-buckets/#dom-storagebucket-getdirectory), whose writes are limited by the quota of the bucket. The task fails with an InvalidStateError once the bucket is deleted (as in Chromium).

public Task<FileSystemDirectoryHandle> GetDirectory()

Requests the bucket to be persistent (https://wicg.github.io/storage-buckets/#dom-storagebucket-persist), as StorageManager.Persist, and returns whether it is.

public Task<bool> Persist()

Returns whether the bucket is persistent (https://wicg.github.io/storage-buckets/#dom-storagebucket-persisted).

public Task<bool> Persisted()

SetExpires(double)

StorageBuckets.cs

Sets the expiration time of the bucket, in milliseconds since the Unix epoch (https://wicg.github.io/storage-buckets/#dom-storagebucket-setexpires).

public Task SetExpires(double expires)