Dexie.js icon indicating copy to clipboard operation
Dexie.js copied to clipboard

dexie-export-import damages file blobs

Open andihub opened this issue 6 years ago • 2 comments

Hi, and at first a huge thank you for this awesome project!

I want to store file blobs uploaded from local machine to indexed db.

Next I want the user to export/import the indexed db using dexie-export-import.

After exporting and then importing the exported file. The file blob stored in indexed db is different from the original. Reading the blob as base64 the changes are only on some characters.

I have written a demo in React on codesandbox where you can play around. The logic using dexie is inside src/DexieDb.js. There is a demo file included. Clicking on the image will show the base64 string. Use any diff tool to compare the base64 strings before and after importing the file.

Is this a problem with Dexie (import/export) or do I use it in a wrong way?

andihub avatar Aug 17 '19 07:08 andihub

The blob encapsulation is implemented in this file: https://github.com/dfahlander/Dexie.js/blob/master/addons/dexie-export-import/src/tson.ts

I had do do it outside of typeson for the same reason, that it could not handle certain characters that got lost in the default typeson implementation an of blob encapsulation using xmlhttprequest.

dfahlander avatar Aug 17 '19 13:08 dfahlander

Any progress on this issue? I'm running into the same problem. Exporting database with Files stored in it, after reimporting, the File objects come back corrupted.

hristoiankov avatar Feb 18 '22 05:02 hristoiankov