This commit is contained in:
Girish Ramakrishnan
2024-07-18 13:31:29 +02:00
parent 01deb4d285
commit b3c301fc2a

View File

@@ -35,6 +35,10 @@ function getBackupFilePath(backupConfig, remotePath) {
}
function addToPack(pack, header, options) {
assert.strictEqual(typeof pack, 'object');
assert.strictEqual(typeof header, 'object');
assert.strictEqual(typeof options, 'object'); // { input }
return new Promise((resolve, reject) => {
const packEntry = safe(() => pack.entry(header, function (error) {
if (error) {
@@ -46,13 +50,9 @@ function addToPack(pack, header, options) {
}
}));
if (!packEntry) {
return reject(new BoxError(BoxError.FS_ERROR, `Failed to add ${header.name}: ${safe.error.message}`));
}
if (!packEntry) return reject(new BoxError(BoxError.FS_ERROR, `Failed to add ${header.name}: ${safe.error.message}`));
if (options?.input) {
safe(stream.pipeline(options.input, packEntry), { debug }); // background. rely on pack.entry callback for promise completion
}
if (options?.input) safe(stream.pipeline(options.input, packEntry), { debug }); // background. rely on pack.entry callback for promise completion
});
}