backuptarget: pseudo target for import and restore

This commit is contained in:
Girish Ramakrishnan
2025-08-01 23:20:51 +02:00
parent 3cabbc1328
commit a01e1bad0f
8 changed files with 90 additions and 77 deletions

View File

@@ -2,6 +2,7 @@
exports = module.exports = {
api,
validateFormat,
};
const assert = require('assert'),
@@ -17,3 +18,11 @@ function api(format) {
throw new BoxError(BoxError.INTERNAL_ERROR, `Undefined format ${format}`);
}
function validateFormat(format) {
assert.strictEqual(typeof format, 'string');
if (format === 'tgz' || format == 'rsync') return null;
return new BoxError(BoxError.BAD_FIELD, 'Invalid backup format');
}