Implement downloadDir for flat-file format
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
exports = module.exports = {
|
||||
upload: upload,
|
||||
download: download,
|
||||
downloadDir: downloadDir,
|
||||
|
||||
copy: copy,
|
||||
|
||||
remove: remove,
|
||||
@@ -74,6 +76,21 @@ function download(apiConfig, sourceFilePath, callback) {
|
||||
callback(null, ps);
|
||||
}
|
||||
|
||||
function downloadDir(apiConfig, backupFilePath, destDir, callback) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
assert.strictEqual(typeof backupFilePath, 'string');
|
||||
assert.strictEqual(typeof destDir, 'string');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
debug('downloadDir: %s -> %s', backupFilePath, destDir);
|
||||
|
||||
shell.exec('copy', '/bin/cp', [ '-r', backupFilePath + '/.', destDir ], { }, function (error) {
|
||||
if (error) return callback(new BackupsError(BackupsError.EXTERNAL_ERROR, error.message));
|
||||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
function copy(apiConfig, oldFilePath, newFilePath, callback) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
assert.strictEqual(typeof oldFilePath, 'string');
|
||||
|
||||
Reference in New Issue
Block a user