idbexport
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

IdbExport

Actions Status

Utility functions for exporting (and re-importing) a whole indexedDB database. It's inspired from indexeddb-export-import but is realised in typescript and is Promise based.

As for now, Date type serialization and deserialization is supported.

Example usage:

import * as idbExport from 'idbexport'

// Export
const sourceDB = await openDB('sourceDB')
const exportedString = await idbExport.exportToJSONString(sourceDB)

// Import back
const db = await openDB('targetDB')
await idbExport.importJSONString(targetDB, exportedString)

exportToJSONString(db)

Export provided database to a json string.

db: IDBDatabase

return a Promise

importJSONString(db, jsonString)

Import a previously created json string into provided database.

db: IDBDatabase
jsonString: string

return a Promise<void[]>

clearDatabase(db)

Clear provided database

db: IDBDatabase

return a Promise<void[]>

Readme

Keywords

Package Sidebar

Install

npm i idbexport

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

1.95 kB

Total Files

2

Last publish

Collaborators

  • markomannux