New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

@encody/storage-idb

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@encody/storage-idb

Persistent IndexedDB storage adapter for the Encody client SDK — offline-capable upload queue

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

@encody/storage-idb

Persistent IndexedDB storage adapter for the Encody client SDK. Plugs into @encody/vue (and @encody/vue2) to make the upload queue — including the queued file Blobs — survive page reloads and browser restarts.

Zero dependencies, ~2 KB, raw IndexedDB in an isolated database.

Install

npm install @encody/storage-idb

Usage

import { IndexedDBAdapter } from '@encody/storage-idb'
import { createEncody } from '@encody/vue/core'

const encody = createEncody({
  token: () => getUploadToken(),
  storage: new IndexedDBAdapter()
})

Or with the Vue composable:

import { IndexedDBAdapter } from '@encody/storage-idb'
import { useEncody } from '@encody/vue'

const { add, files } = useEncody({
  token: () => getUploadToken(),
  storage: new IndexedDBAdapter()
})

Options

const storage = new IndexedDBAdapter({
  dbName: 'encody-uploads', // isolated database name
  requestPersistence: true, // request navigator.storage.persist() on init
  broadcast: true // live cross-tab sync via BroadcastChannel
})

Behavior & caveats

  • Cross-tab sync: changes (status, progress, removals) broadcast to all tabs on the same database via BroadcastChannel — blobs are never sent, other tabs read them from IndexedDB. The SDK core elects a leader tab via the Web Locks API so recovery/drain never duplicates uploads.

  • Files are stored as Blobs via structured clone in the adapter's own database (encody-uploads) — it never shares storage with your app's IndexedDB usage.

  • On WebKit versions with broken Blob cloning, writes transparently fall back to ArrayBuffer storage and rehydrate to a File on read.

  • Storage is best-effort by browser policy: navigator.storage.persist() is requested but heuristically granted. Safari evicts idle script storage after 7 days of no interaction (installed home-screen PWAs are exempt).

  • Resuming queued uploads after a reload requires the queue recovery pass in the SDK core (@encody/vue) — see its documentation.

FAQs

Package last updated on 14 Jul 2026

Related posts