(type, id)
| 289 | } |
| 290 | |
| 291 | async function getObject (type, id) { |
| 292 | if (!cur.cache[type]) { |
| 293 | cur.cache[type] = {}; |
| 294 | } |
| 295 | const cached = cur.cache[type][id]; |
| 296 | if (cached !== undefined) { |
| 297 | return cached; |
| 298 | } |
| 299 | try { |
| 300 | const value = await db.get(type + '_' + id, {valueEncoding: 'json'}); |
| 301 | cur.cache[type][id] = value; |
| 302 | return value; |
| 303 | } catch (err) { |
| 304 | cur.cache[type][id] = null; |
| 305 | return null; |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | function checksum (path, callback, algorithm) { |
| 310 | const stream = fs.createReadStream(path); |
no outgoing calls
no test coverage detected