0
0
DenoHow-ToBeginner ยท 3 min read

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:

  • FILE is the path or URL of the script or module you want to inspect.
  • OPTIONS can modify the output, such as --json for JSON output or --json-path to 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 info with deno run โ€” deno info only inspects, it does not execute.
bash
Wrong usage:
den info

Right usage:
deno info app.ts
๐Ÿ“Š

Quick Reference

OptionDescription
--jsonOutputs information in JSON format.
--json-path <path>Filters JSON output using a JSON path expression.
--reloadReloads remote modules before showing info.
FILEPath 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.