backuptarget: pseudo target for import and restore
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user