UNPKG

azurite

Version:

An open source Azure Storage API compatible server

27 lines 1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class ConditionResourceAdapter { constructor(resource) { if (resource === undefined || resource === null || resource.isCommitted === false // Treat uncommitted blob as unexist resource ) { this.exist = false; this.etag = "UNEXIST_RESOURCE_ETAG"; this.lastModified = undefined; return; } this.exist = true; this.etag = resource.properties.etag; if (this.etag.length < 3) { throw new Error(`ConditionResourceAdapter::constructor() Invalid etag ${this.etag}.`); } if (this.etag.startsWith('"') && this.etag.endsWith('"')) { this.etag = this.etag.substring(1, this.etag.length - 1); } this.lastModified = new Date(resource.properties.lastModified); this.lastModified.setMilliseconds(0); // Precision to seconds } } exports.default = ConditionResourceAdapter; //# sourceMappingURL=ConditionResourceAdapter.js.map