# Storage Buckets API: named partitions

> How navigator.storageBuckets creates separately named storage buckets, how Chrome exposes IndexedDB inside them, and the history of the durability option.

**In one line:** `navigator.storageBuckets` lets a page open multiple, separately
named storage buckets with independent eviction policies. The proposal includes
per-bucket IndexedDB and CacheStorage, while Chrome's documented implementation
currently supports only IndexedDB.

## Opening a bucket

Per Chrome's guide, `navigator.storageBuckets.open(name, options)` creates or
opens a bucket by name and returns a `StorageBucket`:

```js
function openIndexedDB(idbFactory, name, version) {
  return new Promise((resolve, reject) => {
    const request = idbFactory.open(name, version);
    request.onsuccess = () => resolve(request.result);
    request.onerror = () => reject(request.error);
  });
}

async function openTasksBucket() {
  const bucket = await navigator.storageBuckets.open('tasks', {
    persisted: true,
  });
  const db = await openIndexedDB(bucket.indexedDB, 'tasks-db', 1);
  return db;
}
```

Per Chrome's guide, `open()` accepts a boolean `persisted` option. The WICG
explainer says the user agent may decline a `persisted: true` request, and that a
persistent bucket is not evicted under storage pressure without user notice.

## The durability option's history

Chrome's guide (last updated 2022-11-04) documents `open()` accepting a
`durability` option — `'strict'` or `'relaxed'` — as a hint that trades write
performance against the risk of data loss after power failure. The archived
proposal describes writes as complete after persistence to the storage medium
for `strict`, or after flushing to operating-system buffers for `relaxed`. The
current WICG explainer for this
API states that this policy "has been cautiously removed from the first version
of the proposed API, although it may be added back in a later version," citing
limited compelling use cases and the fact that the same durability behavior
remains available directly through IndexedDB's own transaction options. Check
both documents against your target browser's current behavior before relying on
a `durability` option — neither source alone establishes what today's shipping
implementation accepts.

## Where it is supported

Per MDN's browser-compat-data, `StorageBucketManager` (the interface behind
`navigator.storageBuckets`) shipped in Chrome 122. Firefox and Safari do not
implement it; treat storage buckets as a progressive enhancement over the
origin's default storage.

See the [full per-browser support table](/compatibility/storage-buckets/) for
this feature.

## Feature detection and fallback

```js
async function openBucket(name) {
  if (!('storageBuckets' in navigator)) {
    // Unsupported: fall back to the origin's default IndexedDB/Cache storage.
    return null;
  }
  return navigator.storageBuckets.open(name);
}
```

## Practical checklist

- [ ] Feature-detect with `'storageBuckets' in navigator` before calling
      `open()` — Firefox and Safari do not implement this API.
- [ ] Don't assume a `durability` option is accepted by `open()` without
      checking your target browser's current, dated documentation — the WICG
      explainer describes it as removed from the proposed API, not as a
      shipped guarantee.
- [ ] Use separate buckets to give different app data separate eviction
      policies, rather than requesting `persisted: true` for everything.

## Where to go next

- [manifest: storage-buckets browser support](/compatibility/storage-buckets/)
- [Storage & offline](/reference/service-worker/caching-strategies/) — related
  storage capability guidance.