tgz: extract using tar-stream directly
we used have a fork of tar-fs. using tar-stream directly gives us more control
This commit is contained in:
+8
-17
@@ -73,29 +73,20 @@ async function getAvailableSize(apiConfig) {
|
||||
return Number.POSITIVE_INFINITY;
|
||||
}
|
||||
|
||||
function upload(apiConfig, backupFilePath, sourceStream, callback) {
|
||||
async function upload(apiConfig, backupFilePath) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
assert.strictEqual(typeof backupFilePath, 'string');
|
||||
assert.strictEqual(typeof sourceStream, 'object');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
debug(`Uploading to ${backupFilePath}`);
|
||||
|
||||
function done(error) {
|
||||
if (error) {
|
||||
debug(`upload: [${backupFilePath}] gcp upload error. %o`, error);
|
||||
return callback(new BoxError(BoxError.EXTERNAL_ERROR, `Error uploading ${backupFilePath}. Message: ${error.message} HTTP Code: ${error.code}`));
|
||||
}
|
||||
const uploadStream = getBucket(apiConfig)
|
||||
.file(backupFilePath)
|
||||
.createWriteStream({ resumable: false });
|
||||
|
||||
callback(null);
|
||||
}
|
||||
|
||||
const uploadStream = getBucket(apiConfig).file(backupFilePath)
|
||||
.createWriteStream({resumable: false})
|
||||
.on('finish', done)
|
||||
.on('error', done);
|
||||
|
||||
sourceStream.pipe(uploadStream);
|
||||
return {
|
||||
uploadStream,
|
||||
async finish() {}
|
||||
};
|
||||
}
|
||||
|
||||
async function exists(apiConfig, backupFilePath) {
|
||||
|
||||
Reference in New Issue
Block a user