@hpcc-js/observablehq-compiler
Version:
hpcc-js - ObservableHQ Compiler (unoffical)
55 lines (54 loc) • 1.49 kB
JavaScript
import "./chunk-rwCFCtyI.js";
import { t as e } from "./fileAttachment-DCFb8_eF.js";
import t from "https://cdn.jsdelivr.net/npm/jszip/+esm";
//#region ../../node_modules/@observablehq/notebook-kit/dist/src/runtime/stdlib/zip.js
var n = class ZipArchive {
constructor(e) {
Object.defineProperties(this, {
_: { value: e },
filenames: { value: Object.keys(e.files).filter((t) => !e.files[t].dir) }
});
}
static async from(e) {
return new ZipArchive(await t.loadAsync(e));
}
file(e) {
let t = this._.file(e = `${e}`);
if (!t || t.dir) throw Error(`file not found: ${e}`);
return new ZipArchiveEntry(t);
}
}, ZipArchiveEntry = class extends e {
constructor(e) {
super(e.name), Object.defineProperty(this, "href", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}), Object.defineProperties(this, {
_: { value: e },
_url: { writable: !0 }
});
}
async url() {
return this._url ||= this.blob().then(URL.createObjectURL);
}
async blob() {
return this._.async("blob");
}
async arrayBuffer() {
return this._.async("arraybuffer");
}
async text() {
return this._.async("text");
}
async json() {
return JSON.parse(await this.text());
}
async stream() {
return (await this.blob()).stream();
}
};
Object.defineProperty(n, "name", { value: "ZipArchive" }), Object.defineProperty(ZipArchiveEntry, "name", { value: "ZipArchiveEntry" });
//#endregion
export { n as ZipArchive };
//# sourceMappingURL=zip-BCqI2MMo.js.map