Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/proc/mod3.ts

A high-level way to run child processes that is easy, flexible, powerful, and prevents resource leaks.
Go to Latest
import * as proc from "https://deno.land/x/proc@0.20.22/mod3.ts";

Classes

Enumerable wrapper for AsyncIterable.

Thrown because the process returned an exit code that indicates an error occurred. By default, this indicates a non-zero exit code but may be overridden.

A wrapper for Deno.ChildProcess that converts streams to AsyncIterable<...>, corrects error handling, and adds other custom stuff.

Enumerable which may be substituted when we know we are returning Uint8Array data.

c
ProcessError
abstract

A generic process error.

Thrown because the process exited due to a signal. By default, this is thrown for any signal but may be overridden.

Thrown to indicate an error occurred upstream and is being passed forward.

Invert the normal data flow of an AsyncIterable, allowing you to push writes on one side and iterate on the other.

Functions

Transformer that conditionally adds buffering to a Uint8Array stream.

Fast-concatenate Uint8Arrays arrays together, returning a single array containing the result.

Enumerable factory.

Convert JSON-encoded lines into objects.

Convert objects into JSON-encoded lines.

Lazily produce a range of numbers.

Open a file for reading.

Run a process.

Sleep for a while.

Transform text in "chunk" form into lines.

Convert an AsyncIterable<Uint8Array> into an AsyncIterable<Uint8Array[]> (an array of lines chunked together based on buffer size) split on lf and also suppressing trailing cr. lf and trailing cr is removed from the returned lines.

Converts specific types to Uint8Array chunks.

Convert an AsyncIterable<Uint8Array> into an AsyncIterable<string[]> of lines.

Convert an AsyncIterable<Uint8Array> into an AsyncIterable<string> of lines.

Convert Uint8Array to text. The text is not split into lines, so it will contain lf and cr in arbitrary places. Conversion is done as data is received, so this is good for passing stderr and/or stdout data that shows progress (only cr or other positioning codes).

Convert a TransformStream into AsyncIterable. Errors occurring upstream are correctly propagated through the transformation.

Interfaces

Options for Enumerable.concurrentMap and Enumerable.concurrentUnorderedMap.

Options passed to a process.

Command options.

Options for a to range. The to range is exclusive.

Options for an until range. The until value is inclusive.

A writable.

Type Aliases

The type signature for a command.

Optionally change or suppress the error before it is thrown. Note that this will only be called if either one or both of error and stderrData is defined (non-null).

Pipe kinds, matching Deno.Command.

Optionally handle lines of stderr (passed as text lines), and also optionally return a value that is passed to your custom ErrorHandler. You are not allowed to throw an error from this function. If you wish to throw an error based on stderr data, the ErrorHandler function is where you do that.