Reputation: 25267
Im using this command to compress files in node.js:
var command = '7z a ' + dest + ' ' + orig;
exec( command, function(err, stdout, stderr) { ...});
The problem comes when a file has spaces like 7z a my vacation.zip my vacation.pdf
How could I escape dest and orig?
Upvotes: 2
Views: 1209
Reputation: 801
Try to use spawn:
var spawn = require('child_process').spawn,
ls = spawn('ls', ['-l', '/tmp/test with spaces']);
ls.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
Upvotes: 3