How to Use deno info Command for Module and Cache Details
Use the
deno info command to display detailed information about a Deno script or module, including its dependencies and cache location. Run deno info [file] to see the dependency tree and cache paths for that file.Syntax
The basic syntax of deno info is:
deno info [OPTIONS] [FILE]
Where:
FILEis the path or URL of the script or module you want to inspect.OPTIONScan modify the output, such as--jsonfor JSON output or--json-pathto filter JSON.
bash
deno info [OPTIONS] [FILE]
Example
This example shows how to use deno info on a local script app.ts to see its dependencies and cache info.
bash
deno info app.ts
Output
local:///path/to/app.ts
Type: TypeScript
Size: 1234 bytes
Dependencies:
https://deno.land/std@0.177.0/fs/mod.ts
https://deno.land/std@0.177.0/path/mod.ts
Cache Location:
/home/user/.cache/deno/deps/https/deno.land/std@0.177.0/fs/mod.ts
/home/user/.cache/deno/deps/https/deno.land/std@0.177.0/path/mod.ts
Common Pitfalls
Common mistakes when using deno info include:
- Not specifying a file or URL, which shows info about the Deno cache root instead of a specific module.
- Expecting output for scripts that have not been run or cached yet, resulting in minimal info.
- Confusing
deno infowithdeno runโdeno infoonly inspects, it does not execute.
bash
Wrong usage: den info Right usage: deno info app.ts
Quick Reference
| Option | Description |
|---|---|
--json | Outputs information in JSON format. |
--json-path <path> | Filters JSON output using a JSON path expression. |
--reload | Reloads remote modules before showing info. |
FILE | Path or URL of the module to inspect. |
Key Takeaways
Use
deno info [file] to see detailed info about a Deno module's dependencies and cache.Specify the file or URL to get info about that specific script; otherwise, it shows cache root info.
Use
--json option for machine-readable output.Remember
deno info inspects modules but does not run them.Use
--reload to refresh remote dependencies before inspecting.