backups: encrypted backups must have .enc extension
This commit is contained in:
@@ -31,7 +31,6 @@ const assert = require('assert'),
|
||||
BoxError = require('../boxerror.js'),
|
||||
constants = require('../constants.js'),
|
||||
debug = require('debug')('box:storage/gcs'),
|
||||
PassThrough = require('stream').PassThrough,
|
||||
path = require('path'),
|
||||
safe = require('safetydance'),
|
||||
util = require('util');
|
||||
@@ -136,29 +135,14 @@ async function exists(apiConfig, backupFilePath) {
|
||||
}
|
||||
}
|
||||
|
||||
function download(apiConfig, backupFilePath, callback) {
|
||||
async function download(apiConfig, backupFilePath) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
assert.strictEqual(typeof backupFilePath, 'string');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
debug(`Download ${backupFilePath} starting`);
|
||||
|
||||
var file = getBucket(apiConfig).file(backupFilePath);
|
||||
|
||||
var ps = new PassThrough();
|
||||
var readStream = file.createReadStream()
|
||||
.on('error', function(error) {
|
||||
if (error && error.code == 404){
|
||||
ps.emit('error', new BoxError(BoxError.NOT_FOUND));
|
||||
} else {
|
||||
debug(`download: [${backupFilePath}] gcp stream error. %o`, error);
|
||||
ps.emit('error', new BoxError(BoxError.EXTERNAL_ERROR, error));
|
||||
}
|
||||
})
|
||||
;
|
||||
readStream.pipe(ps);
|
||||
|
||||
callback(null, ps);
|
||||
const file = getBucket(apiConfig).file(backupFilePath);
|
||||
return file.createReadStream();
|
||||
}
|
||||
|
||||
function listDir(apiConfig, backupFilePath, batchSize, iteratorCallback, callback) {
|
||||
|
||||
Reference in New Issue
Block a user