* @param {string} hash * @param {Promise } transformPromise
(hash, transformPromise)
| 52 | * @param {Promise<T>} transformPromise |
| 53 | */ |
| 54 | set(hash, transformPromise) { |
| 55 | if (this.transformMap.has(hash)) { |
| 56 | throw new Error(`Read race: Attempting to transform ${hash} file twice.`); |
| 57 | } |
| 58 | this.transformMap.set(hash, transformPromise); |
| 59 | |
| 60 | const filepath = path.join(this.cacheDir, this.key_(hash)); |
| 61 | transformPromise.then((contents) => fs.outputJson(filepath, contents)); |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * @param {string} hash |
no test coverage detected