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:
Girish Ramakrishnan
2024-07-05 17:53:35 +02:00
parent dd9e6e63ad
commit 1dc6b40a68
8 changed files with 305 additions and 244 deletions
+8 -17
View File
@@ -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) {