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

x/proc/mod.ts

A better way to work with processes in Deno.
Latest
import * as proc from "https://deno.land/x/proc@0.22.1/mod.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.

Variables

The number of milliseconds in a day.

The number of milliseconds in an hour.

The number of milliseconds in a minute.

The number of milliseconds in a second.

The number of milliseconds in a week.

Functions

Transformer that conditionally adds buffering to a Uint8Array stream.

fetch and put in one step.

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

Debug output using console.dir through Enumerable#transform.

Enumerable factory.

Fetch a record from KV. Use cache instead; exported for debugging.

Decompress a gzip compressed stream.

Checks if the provided input is a string.

Convert JSON-encoded lines into objects.

Convert objects into JSON-encoded lines.

Lazily create a range of numbers.

Open a file for reading.

Run a process.

Performs an in-place shuffle of an array in linear time.

The sleep function is used to pause the execution of the program for a specified amount of time. It returns a Promise that resolves after a set number of milliseconds, effectively causing a delay in the execution of the subsequent code.

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.

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 a TransformStream into a TransformerFunction. Errors occurring upstream are correctly propagated through the transformation.

Low level write without locking, writing in multiple chunks if needed.

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.

Simplified writable.

Type Aliases

Conditional type for Enumerable.chunkedLines.

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).

Conditional type for Enumerable.lines.

Pipe kinds, matching Deno.Command.

Conditional type for Enumerable.run.

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.

Type signature of a transformer.

Conditional type for Enumerable.unzip.