@uploadx/core
Version:
Node.js resumable upload middleware
19 lines (18 loc) • 441 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Locker = void 0;
const index_1 = require("./index");
class Locker extends index_1.Cache {
lock(key) {
const locked = this.get(key);
if (locked) {
throw new Error(`${key} is locked`);
}
this.set(key, key);
return key;
}
unlock(key) {
this.delete(key);
}
}
exports.Locker = Locker;