Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- prospectsDB.changes(since, function(err, doc){
- prospectsDB.get(doc.id, function(err, doc){
- var csvEntry ="";
- console.log('changes');
- if(doc){
- console.log('since: '+since);
- for(value in doc){
- //replace any semicolos with commas and use a semi colon as the delimiter.
- csvItem = JSON.stringify(doc[value]);
- csvItem = csvItem.replace(';',',');
- csvEntry += csvItem + ';';
- console.log(value+' : '+csvItem);
- }
- console.log('doc')
- var csvEntry = csvEntry + "\n";
- var filename = '/home/virtual/vibrantrioja.com/var/www/html/grandtasting/signups.csv';
- fs.open(filename, 'a',0666,function(err,fd) {
- console.log('open');
- fs.write(fd,csvEntry,null,'utf-8',function(err,fd){
- fs.close(fd);
- console.log('write');
- console.log(csvEntry);
- });
- });
- newSignUps = 1;
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement