UNPKG

@e280/quay

Version:

File-browser and outliner UI for the web

23 lines 618 B
import { Hex } from "@e280/stz"; import { blake3 } from "@awasm/noble"; /** File with a hash label */ export class Cask { hash; file; static async hash(file) { const hasher = blake3.create(); for await (const chunk of file.stream()) hasher.update(chunk); const digest = hasher.digest(); return Hex.fromBytes(digest); } static async make(file) { const hash = await this.hash(file); return new this(hash, file); } constructor(hash, file) { this.hash = hash; this.file = file; } } //# sourceMappingURL=cask.js.map