You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
892 B

"use strict";
/**
* @typedef Slice
* @property {number} offset
* @property {number} length
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseSource = void 0;
class BaseSource {
/**
*
* @param {Slice[]} slices
* @returns {ArrayBuffer[]}
*/
async fetch(slices, signal = undefined) {
return Promise.all(slices.map((slice) => this.fetchSlice(slice, signal)));
}
/**
*
* @param {Slice} slice
* @returns {ArrayBuffer}
*/
async fetchSlice(slice) {
throw new Error(`fetching of slice ${slice} not possible, not implemented`);
}
/**
* Returns the filesize if already determined and null otherwise
*/
get fileSize() {
return null;
}
async close() {
// no-op by default
}
}
exports.BaseSource = BaseSource;
//# sourceMappingURL=basesource.js.map