Skip to main content

Deno CLI's module cache.

Works with
This package works with Deno
JSR Score
76%
Published
3 months ago (0.8.0)

A module which provides a TypeScript implementation of the Deno CLI's cache directory logic (DENO_DIR). This can be used in combination with other modules to provide user loadable APIs that are like the Deno CLI's functionality.

This also can provide user read access in Deploy to a Deno CLI's cache when the cache is checked into the repository.

Example

import { createCache } from "@deno/cache-dir";
import { createGraph } from "@deno/graph";

// create a cache where the location will be determined environmentally
const cache = createCache();
// destructuring the two functions we need to pass to the graph
const { cacheInfo, load } = cache;
// create a graph that will use the cache above to load and cache dependencies
const graph = await createGraph("https://deno.land/x/oak@v9.0.1/mod.ts", {
  cacheInfo,
  load,
});

// log out the console a similar output to `deno info` on the command line.
console.log(graph.toString());

Add Package

deno add @deno/cache-dir

Import symbol

import * as mod from "@deno/cache-dir";