Use the crypto_wasm package
mainstd/_crypto_wasm package is intended for internal use only (e.g., by std/crypto). Its interface is unstable and may change between releases. Do not import this package directly into your own projects.repository·main·Indexed 25 days ago
https://github.com/denoland/stdA collection of high-quality, reliable APIs for Deno and web environments. Includes modules for text formatting (@std/fmt), command line argument parsing (parseArgs), sensitive input handling (promptSecret), Unicode width calculation, and ANSI escape sequences for terminal manipulation. Newer versions (>= 1.0.0) are hosted on JSR, while older versions (up to 0.224.0) remain available at deno.land/std.
std/_crypto_wasm package is intended for internal use only (e.g., by std/crypto). Its interface is unstable and may change between releases. Do not import this package directly into your own projects.The Deno Standard Library provides high-quality APIs for Deno and the web.
Important Versioning Note:
To use the latest modules, you should use the JSR registry.
The @std/fmt library provides utilities for formatting various text types, including human-readable bytes, CLI styles (colors), time durations, and printf-style string formatting.
Note that while most modules support all major runtimes, the printf module has Deno-specific features (such as %v, %i, and %I format specifiers) that may not be available in other runtimes.
import { format } from "@std/fmt/bytes";
import { red } from "@std/fmt/colors";
console.log(red(format(1337))); // Prints "1.34 kB"Use @std/fmt/printf for printf-style string formatting.
Runtime Compatibility Warning: While mostly compatible with major runtimes, certain format specifiers like %v, %i, and %I are exclusive to Deno.
@std/fmt/colors to apply styles to text for CLI output. This module is compatible with all major runtimes.To regenerate the Wasm files in the ./lib/ folder from the Rust source code, run the following command from the repository root.
deno task build:crypto@std/fmt/duration to format time durations. This module is compatible with all major runtimes.@std/fmt/bytes to convert numeric byte values into human-readable strings (e.g., converting 1337 to "1.34 kB"). This module is compatible with all major runtimes.The @std/cli/unstable-ansi module provides constants and functions to generate ANSI escape sequences. These sequences can be used to manipulate terminal behavior, such as moving the cursor, erasing text, or changing character width.
Note: These codes do not change terminal settings automatically; they only take effect when passed to stdout or stderr. This module is browser compatible. Because this is an unstable API, terminal compatibility is not guaranteed.
import * as Ansi from "@std/cli/unstable-ansi";
console.log(Ansi.DOUBLE_HEIGHT_TOP + "Hello World!");
console.log(Ansi.DOUBLE_HEIGHT_BOTTOM + "Hello World!");When instantiating a Spinner, you can provide a SpinnerOptions object to customize its behavior:
| Option | Type | Default | Description |
|---|---|---|---|
spinner | string[] | ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"] | The sequence of characters used for the animation frames. |
message | string | "" | The text displayed next to the spinner. Can be updated dynamically via the message property. |
interval | number | 75 | The delay between animation frames in milliseconds. |
color | Color | undefined | The color of the spinner. Defaults to the terminal default. |
output | Deno.stdout | Deno.stderr | Deno.stdout | The stream to which the spinner writes. |
When instantiating ProgressBar, you can provide a ProgressBarOptions object to customize its behavior:
| Option | Type | Default | Description |
|---|---|---|---|
max | number | Required | The total value representing 100% progress. |
writable | WritableStream<Uint8Array> | Deno.stderr.writable | The stream where progress reports are written. |
value | number | 0 | The starting offset for progress. |
barLength | number | 50 | The character length of the progress bar. |
fillChar | string | '#' | The character used to fill the bar. |
emptyChar | string | '-' | The character used for the remaining bar length. |
clear | boolean | false | If true, the progress bar line is cleared from the terminal upon completion. |
formatter | (formatter: ProgressBarFormatter) => string | defaultFormatter | A function to define custom visual output. |
keepOpen | boolean | true | Whether to keep the writable stream open after the progress bar stops. |
interval | number | 1000 | The update interval in milliseconds. |
The color property of a Spinner instance can be set using the Color type. This can be changed while the spinner is actively running. Providing undefined reverts the spinner to the default terminal color.
Supported Color values:
black, red, green, yellow, blue, magenta, cyan, white, grayAnsi escape sequence string.import { Spinner } from "@std/cli/unstable-spinner";
const spinner = new Spinner({ message: "Loading...", color: "yellow" });
spinner.start();
// ... do work ...
// Change color dynamically
spinner.color = "magenta";