pouchdb-community / pouchdb-replication-stream

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

error shows as "fs is not defined" #62

Closed ashrafkm closed 7 years ago

ashrafkm commented 7 years ago
var ws = fs.createWriteStream('output.txt');
  db.dump(ws).then(function (res) {
  // res should be {ok: true}
});

what is fs in above code. for me error showing as fs is not defined. below is my code I have modified..

var db=new PouchDB('company_details');
function dumpdata(){
  var ws = fs.createWriteStream('file:///C:/xampp/htdocs/sevenadmin/db/output.txt');

  db.dump(ws).then(function (res) {
    //res should be {ok: true}
  }); 
}
nolanlawson commented 7 years ago

var fs = require('fs') should fix it. Note that that particular code only works in Node and is intended for illustration purposes.