From 459db1d0d6004c71bc51abf35d153c4411fca3bd Mon Sep 17 00:00:00 2001 From: David Fahlander Date: Fri, 14 Jun 2024 10:29:17 +0200 Subject: [PATCH] Update dexie-export-import.md Highlight peelImportFile() and other API examples. --- docs/ExportImport/dexie-export-import.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/ExportImport/dexie-export-import.md b/docs/ExportImport/dexie-export-import.md index b74c4d9a..5c183436 100644 --- a/docs/ExportImport/dexie-export-import.md +++ b/docs/ExportImport/dexie-export-import.md @@ -21,27 +21,36 @@ Here's the basic usage. There's a lot you can do by supplying optional `[options import Dexie from "dexie"; import {importDB, exportDB, importInto, peakImportFile} from "dexie-export-import"; +// +// --- importDB() --- // // Import from Blob or File to Dexie instance: // const db = await importDB(blob, [options]); +// +// --- exportDB() --- // // Export to Blob // const blob = await exportDB(db, [options]); +// +// --- importInto() --- // // Import from Blob or File to existing Dexie instance // await importInto(db, blob, [options]); +// +// --- peakImportFile() --- // // If you need to peek the metadata from the import file without actually // performing any import operation // (since v1.0.0) // const importMeta = await peakImportFile(blob); + assert.areEqual(importMeta.formatName, "dexie"); assert.isTrue(importMeta.formatVersion === 1); console.log("Database name:", importMeta.data.databaseName); @@ -61,16 +70,22 @@ Note that you can also import the package as follows: import Dexie from "dexie"; import "dexie-export-import"; +// +// --- Dexie.import() --- // // Import from Blob or File to Dexie instance: // const db = await Dexie.import(blob, [options]); // equivalent to importDB() +// +// --- db.export() --- // // Export to Blob // const blob = await db.export([options]); // equivalent to exportDB() +// +// --- db.import() --- // // Import from Blob or File to existing Dexie instance //