-
Notifications
You must be signed in to change notification settings - Fork 59
Description
PouchDB and pouchdb-replication-stream included via script tags at top of page.
<script src="./lib/pouchdb-6.3.4.min.js"></script>
<script src="./lib/pouchdb.find.js"></script>
<script src="./lib/pouchdb.upsert.min.js"></script>
<script src="./lib/pouchdb.authentication-0.5.5.min.js"></script>
<script src="./lib/pouchdb.erase.min.js"></script>
<script src="./lib/pouchdb.replication-stream.js"></script>
<script src="./lib/pouchdb-cordova-sqlite-2.02.js"></script>
Calling targetDB.load(sourceString)
results in an error of readableStream.pipe is not a function
.
mm.pdb.pouch = new PouchDB('pdb', {revs_limits: 20,adapter: 'cordova-sqlite'});
// Receive zip file from server, extract it into a text file, then
mm.pdb.pouch.load(dbDumpTxt
).then(function(r){
console.log('Loaded from file!');
mm.pdb.initSyncing();
}).catch(function(e){
console.error('Could not restore from file, proceeding with normal sync. Message:',e.message);
});
I can use pouchdb-load with the same dbDumpTxt file, but it seems to cause a slew of network activity following the .load (even with proper proxy option supplied), so I'm trying to see if pouchdb-replication-stream's .load() is better.
Has anyone else run into this .pipe() issue?
Looks like it's because .load() expects a STREAM, not a STRING. I've just dug into learning about streams (Node.js, BufferedStreams, HighLander, mozilla developer versiosn), and it looks like they are slightly different. Any chance that this .load() function could be modified to also accept an input string, as that is what .dump() creates?