18 lines
558 B
JavaScript
18 lines
558 B
JavaScript
|
|
/**
|
||
|
|
* WORM (Write Once Read Many) mode storage
|
||
|
|
*/
|
||
|
|
import { StorageClient } from './storage';
|
||
|
|
export class WORMStorage extends StorageClient {
|
||
|
|
async upload(object) {
|
||
|
|
// WORM mode: prevent overwrites
|
||
|
|
const exists = await this.objectExists(object.key);
|
||
|
|
if (exists) {
|
||
|
|
throw new Error(`Object ${object.key} already exists in WORM storage`);
|
||
|
|
}
|
||
|
|
return super.upload(object);
|
||
|
|
}
|
||
|
|
async delete(_key) {
|
||
|
|
throw new Error('Deletion not allowed in WORM mode');
|
||
|
|
}
|
||
|
|
}
|
||
|
|
//# sourceMappingURL=worm.js.map
|