You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. Currently trying to get this working restoring from a dump in our web extension. Everything's currently happening in the browser, using memorystream to handle the node-like streams.
Dumping is working fine: in some test code, I can collect the dump string all in memory, build an in-memory File, then creating an object URL to download it as a file.
Can read it back in to memory through a input[type='file'] and use FileReader to write its contents to another stream (FileReader.readAsText()) and pass that stream to .load(). However that's throwing the following TypeError once I signal end on the stream:
Uncaught (in promise) TypeError: Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1 is not of type 'Blob'.
at readAsArrayBuffer (index.js:4198)
at appendBlob (index.js:4222)
at loadNextChunk (index.js:4265)
at binaryMd5 (index.js:4268)
at preprocessBlob (index.js:4306)
at preprocessAttachment (index.js:4333)
at index.js:4365
at Array.forEach (<anonymous>)
at preprocessAttachments (index.js:4346)
at idbBulkDocs (index.js:4839)
Creating a test Pouch instance and just doing a direct await Promise.all([db.dump(stream), testDB.load(stream)]) is throwing the same error.
Checking the DB, it loads in 400 docs, however the dump contains more than that.
Furthermore, using the pouchdb-load plugin (putting it on a different namespace to .load(), of course) and using FileReader.readAsText() to just pass the text content of the dump file straight into that package's .load() gives the same error. I understand that is a different package to this repo, but the fact that its throwing the same error may indicate something?
Trying with dumps from different DB contents gives the same thing. The dumps look to be in the correct newline delimited JSON as documented here (not modifying them at all).
Probably I'm missing something obvious, but have you ever seen this or any ideas what's causing this? Is there something special about the number of 400 docs for restoring from dumps? Should I split the dump files into roughly 400 docs dumps then write them to the .load() stream in batches of 400?
Thanks for taking the time to read, and let me know if you need any further info 👍
The text was updated successfully, but these errors were encountered:
Seems to be the _attachments on docs causing this issue, so probably related to the other attachment-related issues. Manually removing the doc _attachments and trying the same dump + restore code works fine on a restore.
Not sure if of any use, but the attachments on my docs include types image/x-icon, image/png, and text/html, all stored as Blobs.
I get the same error only that I'm dumping the pouchdb from nodejs and loading the string in the browser.
Below is the file generated by nodejs' pouch and can't be imported using the following code:
Hello. Currently trying to get this working restoring from a dump in our web extension. Everything's currently happening in the browser, using memorystream to handle the node-like streams.
Dumping is working fine: in some test code, I can collect the dump string all in memory, build an in-memory File, then creating an object URL to download it as a file.
Can read it back in to memory through a
input[type='file']
and use FileReader to write its contents to another stream (FileReader.readAsText()
) and pass that stream to.load()
. However that's throwing the following TypeError once I signalend
on the stream:Creating a test Pouch instance and just doing a direct
await Promise.all([db.dump(stream), testDB.load(stream)])
is throwing the same error.Checking the DB, it loads in 400 docs, however the dump contains more than that.
Furthermore, using the
pouchdb-load
plugin (putting it on a different namespace to.load()
, of course) and usingFileReader.readAsText()
to just pass the text content of the dump file straight into that package's.load()
gives the same error. I understand that is a different package to this repo, but the fact that its throwing the same error may indicate something?Trying with dumps from different DB contents gives the same thing. The dumps look to be in the correct newline delimited JSON as documented here (not modifying them at all).
Probably I'm missing something obvious, but have you ever seen this or any ideas what's causing this? Is there something special about the number of 400 docs for restoring from dumps? Should I split the dump files into roughly 400 docs dumps then write them to the
.load()
stream in batches of 400?Thanks for taking the time to read, and let me know if you need any further info 👍
The text was updated successfully, but these errors were encountered: