UNPKG

@dfinity/assets

Version:

JavaScript and TypeScript library to manage assets on the Internet Computer

23 lines 622 B
import mime from 'mime/lite.js'; export class ReadableBlob { constructor(fileName, blob) { this.fileName = fileName; this._blob = blob; } get contentType() { return this._blob.type || (mime.getType(this.fileName) ?? 'application/octet-stream'); } get length() { return this._blob.size; } async open() { return Promise.resolve(); } async close() { return Promise.resolve(); } async slice(start, end) { return new Uint8Array(await this._blob.slice(start, end).arrayBuffer()); } } //# sourceMappingURL=readableBlob.js.map