Problem with backup db with "https://github.com/hex7c0/mongodb-backup"?


#1

I use the https://github.com/hex7c0/mongodb-backup with meteorhacks:picker.

var Busboy, backup, fs, path, restore;

backup = Npm.require('mongodb-backup');

restore = Npm.require('mongodb-restore');

Busboy = Npm.require("busboy");

path = Npm.require('path');

fs = Npm.require('fs');

Picker.route('/backup', function (params, req, res, next) {
    var backupOptions, filename;

    filename = 'backup.tar';

    res.statusCode = 200;
    res.setHeader('Content-disposition', "attachment; filename=" + filename);
    backupOptions = {
        uri: process.env.MONGO_URL,
        stream: res,
        tar: 'dump.tar'
    };

    backup(backupOptions);
});

I is OK, if the small size of DB ~ < 1 M.
But it don’t work if size of DB ~ >1 M.

W20151003-11:52:41.631(7)? (STDERR) fs.js:624                                                                                                    
W20151003-11:52:41.631(7)? (STDERR)   return binding.rmdir(pathModule._makeLong(path));                                                          
W20151003-11:52:41.631(7)? (STDERR)                  ^                                                                                           
W20151003-11:52:41.631(7)? (STDERR) Error: ENOTEMPTY, directory not empty 'D:\meteor-app\cpanel\packages\backup-restore\.npm\package\node_modules
ongodb-backup\dump\meteor\sample_location'                                                                                                       
W20151003-11:52:41.631(7)? (STDERR)     at Object.fs.rmdirSync (fs.js:624:18)                                                                    
W20151003-11:52:41.632(7)? (STDERR)     at D:\meteor-app\cpanel\packages\backup-restore\.npm\package\node_modules\mongodb-backup\index.min.js:38:
                                                                                                                                                 
W20151003-11:52:41.632(7)? (STDERR)     at D:\meteor-app\cpanel\packages\backup-restore\.npm\package\node_modules\mongodb-backup\index.min.js:33:
                                                                                                                                                 
W20151003-11:52:41.632(7)? (STDERR)     at Array.forEach (native)                                                                                
W20151003-11:52:41.632(7)? (STDERR)     at Array.forEach (native)                                                                                
W20151003-11:52:41.633(7)? (STDERR)     at rmDir (D:\meteor-app\cpanel\packages\backup-restore\.npm\package\node_modules\mongodb-backup\index.min
s:28:33)                                                                                                                                         
W20151003-11:52:41.633(7)? (STDERR)     at Pack._process (D:\meteor-app\cpanel\packages\backup-restore\.npm\package\node_modules\mongodb-backup\n
e_modules\tar\lib\pack.js:121:8)                                                                                                                 
W20151003-11:52:41.634(7)? (STDERR)     at Pack.end (D:\meteor-app\cpanel\packages\backup-restore\.npm\package\node_modules\mongodb-backup\node_m
ules\tar\lib\pack.js:87:8)                                                                                                                       
W20151003-11:52:41.633(7)? (STDERR)     at Pack.emit (events.js:117:20)                                                                          
W20151003-11:52:41.633(7)? (STDERR)     at Pack.<anonymous> (D:\meteor-app\cpanel\packages\backup-restore\.npm\package\node_modules\mongodb-backu
index.min.js:147:40)                                                                                                                             
W20151003-11:52:41.634(7)? (STDERR)     at DirReader._read (D:\meteor-app\cpanel\packages\backup-restore\.npm\package\node_modules\mongodb-backup
ode_modules\fstream\lib\dir-reader.js:80:12)                                                                                                     
W20151003-11:52:41.634(7)? (STDERR)     at DirReader.emit (events.js:117:20)                                                                     
W20151003-11:52:41.635(7)? (STDERR)     at DirReader.emit (events.js:117:20)                                                                     
W20151003-11:52:41.635(7)? (STDERR)     at DirReader.onend (D:\meteor-app\cpanel\packages\backup-restore\.npm\package\node_modules\mongodb-backup
ode_modules\fstream\lib\dir-reader.js:171:14)                                                                                                    
W20151003-11:52:41.635(7)? (STDERR)     at DirReader._read (D:\meteor-app\cpanel\packages\backup-restore\.npm\package\node_modules\mongodb-backup
ode_modules\fstream\lib\dir-reader.js:81:12)                                                                                                     
W20151003-11:52:41.634(7)? (STDERR)     at DirReader.onend (stream.js:79:10)                                                                     
                                                                                                                                                 
http.js:732                                                                                                                                      
    throw new Error('Can\'t render headers after they are sent to the client.'                                                                   
          ^                                                                                                                                      
Error: Can't render headers after they are sent to the client.                                                                                   
  at ServerResponse.OutgoingMessage._renderHeaders (http.js:732:11)                                                                              
  at ServerResponse.writeHead (http.js:1153:20)                                                                                                  
  at ProxyServer.<anonymous> (C:\Users\Theara\AppData\Local\.meteor\packages\meteor-tool\1.1.4\mt-os.windows.x86_32\tools\run-proxy.js:96:21)    
  at ProxyServer.emit (C:\Users\Theara\AppData\Local\.meteor\packages\meteor-tool\1.1.4\mt-os.windows.x86_32\dev_bundle\lib\node_modules\eventemi
er3\index.js:100:27)                                                                                                                             
  at ClientRequest.proxyError (C:\Users\Theara\AppData\Local\.meteor\packages\meteor-tool\1.1.4\mt-os.windows.x86_32\dev_bundle\lib\node_modules\
tp-proxy\lib\http-proxy\passes\web-incoming.js:140:16)                                                                                           
  at ClientRequest.emit (events.js:117:20)                                                                                                       
  at Socket.socketErrorListener (http.js:1552:9)                                                                                                 
  at Socket.emit (events.js:95:17)                                                                                                               
  at net.js:441:14                                                                                                                               
  at process._tickCallback (node.js:442:13)                                                                                                      

Please help me.