( moduleURI: string, lix: Lix )
| 15 | } |
| 16 | |
| 17 | async function readModuleFromCache( |
| 18 | moduleURI: string, |
| 19 | lix: Lix |
| 20 | ): Promise<string | undefined> { |
| 21 | const moduleHash = escape(moduleURI); |
| 22 | const filePath = `/cache/plugins/${moduleHash}`; |
| 23 | |
| 24 | const file = await lix.db |
| 25 | .selectFrom("file") |
| 26 | .where("path", "=", filePath) |
| 27 | .selectAll() |
| 28 | .executeTakeFirst(); |
| 29 | |
| 30 | if (file) { |
| 31 | return new TextDecoder().decode(file.data); |
| 32 | } |
| 33 | return undefined; |
| 34 | } |
| 35 | |
| 36 | async function writeModuleToCache( |
| 37 | moduleURI: string, |