StorageManager Class

The storage manager of a window or of a worker (https://storage.spec.whatwg.org/#storagemanager, Navigator.Storage): the estimation of the usage of the storage of its origin, the persistence of that storage, and the root directory of its origin private file system (https://fs.spec.whatwg.org/).

public sealed class StorageManager

Methods

NameDescription
Estimate()Returns an estimation of the usage and of the quota of the storage of the origin (https://storage.spec.whatwg.org/#dom-storagemanager-estimate). The usage is the sum of what the storages of the origin report: the local storage, and the backends of IndexedDB (IndexedDBBackend.GetUsage), of the Cache API (CacheStorageBackend.GetUsage) and of the file system (FileSystemBackend.GetUsage). The quota is StorageOptions.Quota.
GetDirectory()Returns the root directory of the origin private file system (https://fs.spec.whatwg.org/#dom-storagemanager-getdirectory), the bucket file system of the storage key of the window or of the worker, stored by BrowsingContextOptions.FileSystem. The task fails with a SecurityError when the origin is opaque.
Persist()Requests the storage of the origin to be persistent (https://storage.spec.whatwg.org/#dom-storagemanager-persist), and returns whether it is: the host grants the "persistent-storage" permission with StorageOptions.RequestPersistentStorage (it is denied by default). The request of a prerendering document is made when the document is activated.
Persisted()Returns whether the storage of the origin is persistent (https://storage.spec.whatwg.org/#dom-storagemanager-persisted): the mode of its local storage bucket is "persistent", so the user agent does not clear it under storage pressure. The task fails with a TypeErrorException when the origin is opaque.

Returns an estimation of the usage and of the quota of the storage of the origin (https://storage.spec.whatwg.org/#dom-storagemanager-estimate). The usage is the sum of what the storages of the origin report: the local storage, and the backends of IndexedDB (IndexedDBBackend.GetUsage), of the Cache API (CacheStorageBackend.GetUsage) and of the file system (FileSystemBackend.GetUsage). The quota is StorageOptions.Quota.

public Task<StorageEstimate> Estimate()

GetDirectory()

StorageManager.cs

Returns the root directory of the origin private file system (https://fs.spec.whatwg.org/#dom-storagemanager-getdirectory), the bucket file system of the storage key of the window or of the worker, stored by BrowsingContextOptions.FileSystem. The task fails with a SecurityError when the origin is opaque.

public Task<FileSystemDirectoryHandle> GetDirectory()

Requests the storage of the origin to be persistent (https://storage.spec.whatwg.org/#dom-storagemanager-persist), and returns whether it is: the host grants the "persistent-storage" permission with StorageOptions.RequestPersistentStorage (it is denied by default). The request of a prerendering document is made when the document is activated.

public Task<bool> Persist()

Returns whether the storage of the origin is persistent (https://storage.spec.whatwg.org/#dom-storagemanager-persisted): the mode of its local storage bucket is "persistent", so the user agent does not clear it under storage pressure. The task fails with a TypeErrorException when the origin is opaque.

public Task<bool> Persisted()