denoland / deno_cache_dir

Deno CLI's module cache

Home Page:https://jsr.io/@deno/cache-dir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use deno cache itself rather than create a redundant second one

caramboleyo opened this issue · comments

Hello,

in this issue i suggested a Deno.fromCache function, they told me to try here.

Problem is, that this cache extension creates its own folder inside DENO_DIR not using the original cache and only works with a lot of extra permissions.

I think getting real cache data will only work if it is provided by the deno rust stuff under the hood.

This does use the same local cache folders that Deno uses.

It allows you get any previously cached files, and fetch (and optionally cache) new files in the same way that Deno does, although the API isn't particularly friendly for that.

I needed to fetch additional text files that live alongside my modules, so created a small utility function to do that... https://deno.land/x/import_content

(although it's currently awaiting some bug fixes in deno_cache atm)

This is now using the same Rust code as the deno cli does.