Skip to main content
Module

x/proc/mod.ts

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

Correct check to see if something 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.

Perfect in-place array shuffle in linear time.

Sleep for a while.

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. As this is line-oriented data, if the last line is empty (the last byte was a line feed, splitting into one extra line), it is suppressed.

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.