All files / src/web hfe-source.js

100% Statements 5/5
100% Branches 0/0
100% Functions 3/3
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12            2x 2x 2x      
import { BbcDiscArchive } from "../bbcdiscs.js";
import { describeHfeEntry } from "./media-catalogue.js";
 
/** The HFE archive as a media source: its catalogue with the metadata it carries, and its fetcher. */
export class HfeSource {
    constructor({ media }) {
        this.archive = new BbcDiscArchive();
        media.addSource("hfe", (path) => this.archive.fetch(path));
        media.addLister("hfe", async () => (await this.archive.catalogue()).map(describeHfeEntry));
    }
}