Skip to content

Instantly share code, notes, and snippets.

View RecuencoJones's full-sized avatar
👨‍💻
JavaScript Developer @ adidas

David Recuenco RecuencoJones

👨‍💻
JavaScript Developer @ adidas
View GitHub Profile
@RecuencoJones
RecuencoJones / idb-backup-and-restore.md
Last active April 22, 2024 12:26 — forked from loilo/idb-backup-and-restore.js
Back up and restore an IndexedDB database

Back up and restore an IndexedDB database

This gist is an ES module which provides functions to import and export data from an IndexedDB database as JSON. It's based on Justin Emery's indexeddb-export-import package, but applies some adjustments that reflect better on the current browser landscape (i.e. better developer ergonomics but no support for Internet Explorer).

Usage

For each of the provided functionalities, you need a connected IDBDatabase instance.

Export Data

import { idb } from 'some-database'