pouchdb-community / pouchdb-replication-stream

Replicate PouchDB/CouchDB databases with Node.js-style streams
Apache License 2.0
189 stars 58 forks source link

Cannot dump to a string #67

Open group131 opened 7 years ago

group131 commented 7 years ago

Hello, I'm trying to implement the "If you aren't using Browserify, then you can download MemoryStream from https://wzrd.in/standalone/memorystream@latest and it will be available as window.memorystream." scenario.

My function is:

function dump() { var stream = window.MemoryStream;

var dumpedString = ''; stream.on('data', function(chunk) { dumpedString += chunk.toString(); });

db.dump(stream).then(function () { console.log('Yay, I have a dumpedString: ' + dumpedString); }).catch(function (err) { console.log('oh no an error', err); }); }

I get:

scripts.js:25 Uncaught TypeError: Cannot read property 'on' of undefined at dump (scripts.js:25) at HTMLDocument. (scripts.js:17) at j (jQuery-2.1.4.min.js:2) at Object.fireWith [as resolveWith] (jQuery-2.1.4.min.js:2) at Function.ready (jQuery-2.1.4.min.js:2) at HTMLDocument.I (jQuery-2.1.4.min.js:2)

Any ideas?