s3: fix restore

This commit is contained in:
Girish Ramakrishnan
2017-09-28 14:26:39 -07:00
parent 5123b669d7
commit 19999abc50
4 changed files with 37 additions and 29 deletions

View File

@@ -70,13 +70,10 @@ function download(apiConfig, sourceFilePath, callback) {
debug('download: %s', sourceFilePath);
var ps = new PassThrough();
if (!safe.fs.existsSync(sourceFilePath)) return callback(new BackupsError(BackupsError.NOT_FOUND, 'File not found'));
var fileStream = fs.createReadStream(sourceFilePath);
fileStream.on('error', function (error) {
ps.emit('error', new BackupsError(BackupsError.NOT_FOUND, error.message));
});
fileStream.pipe(ps);
callback(null, ps);
callback(null, fileStream);
}
function downloadDir(apiConfig, backupFilePath, destDir, callback) {