(cb: (name: string, objs: FileSystem[]) => void)
| 5 | |
| 6 | const isodir = "/test/fixtures/isofs"; |
| 7 | export default function IsoFSFactory(cb: (name: string, objs: FileSystem[]) => void): void { |
| 8 | if (IsoFS.isAvailable()) { |
| 9 | XHRFSFactory((_, xhrfs) => { |
| 10 | if (xhrfs.length === 0) { |
| 11 | return cb('IsoFS', xhrfs); |
| 12 | } |
| 13 | |
| 14 | // Leverage the XHRFS to download the fixtures for this FS. |
| 15 | BrowserFS.initialize(xhrfs[0]); |
| 16 | let fs = BrowserFS.BFSRequire('fs'); |
| 17 | |
| 18 | // Add three Zip FS variants for different zip files. |
| 19 | let isoFiles = fs.readdirSync(isodir); |
| 20 | let rv: FileSystem[] = []; |
| 21 | let countdown = isoFiles.length; |
| 22 | function fetchIso(isoFilename: string): void { |
| 23 | fs.readFile(isoFilename, (e, data?) => { |
| 24 | if (e) throw e; |
| 25 | IsoFS.Create({ |
| 26 | data: data, |
| 27 | name: isoFilename |
| 28 | }, (e, fs?) => { |
| 29 | if (e) { |
| 30 | throw e; |
| 31 | } |
| 32 | rv.push(fs); |
| 33 | countdown--; |
| 34 | if (countdown === 0) { |
| 35 | cb('IsoFS', rv); |
| 36 | } |
| 37 | }); |
| 38 | }); |
| 39 | } |
| 40 | for (let i = 0; i < isoFiles.length; i++) { |
| 41 | fetchIso(`${isodir}/${isoFiles[i]}`); |
| 42 | } |
| 43 | }); |
| 44 | } else { |
| 45 | cb('IsoFS', []); |
| 46 | } |
| 47 | } |
nothing calls this directly
no test coverage detected