(blob)
| 40 | }); |
| 41 | |
| 42 | const storeFileInIDB = async (blob) => { |
| 43 | try { |
| 44 | performance.mark('start-idb-cache'); |
| 45 | await set('model.bin', blob); |
| 46 | performance.mark('end-idb-cache'); |
| 47 | const mark = performance.measure( |
| 48 | 'idb-cache', |
| 49 | 'start-idb-cache', |
| 50 | 'end-idb-cache' |
| 51 | ); |
| 52 | console.log( |
| 53 | 'Model file cached in IDB.', |
| 54 | mark.name, |
| 55 | mark.duration.toFixed(2) |
| 56 | ); |
| 57 | } catch (err) { |
| 58 | console.error(err.name, err.message); |
| 59 | } |
| 60 | }; |
| 61 | |
| 62 | const storeFileInOPFS = async (blob) => { |
| 63 | try { |