Skip to content

Commit

Permalink
site docs
Browse files Browse the repository at this point in the history
  • Loading branch information
j50n committed Oct 22, 2024
1 parent 7a520e5 commit f1e8084
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 48 deletions.
6 changes: 3 additions & 3 deletions docs/example-concurrent-processing.html
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ <h1 id="concurrent-processes"><a class="header" href="#concurrent-processes">Con
most storage. <code>proc</code> makes it possible to run <code>ls --summarize</code> with parallelism
matching the number of CPU cores available (or whatever concurrency you
specify). The specific methods that support concurrent operations are
<a href="https://deno.land/x/proc@0.21.10/mod3.ts?s=Enumerable&amp;p=prototype.concurrentMap">.concurrentMap()</a>
<a href="https://deno.land/x/proc@0.22.1/mod3.ts?s=Enumerable&amp;p=prototype.concurrentMap">.concurrentMap()</a>
and
<a href="https://deno.land/x/proc@0.21.10/mod3.ts?s=Enumerable&amp;p=prototype.concurrentUnorderedMap">.concurrentUnorderedMap()</a>.</p>
<a href="https://deno.land/x/proc@0.22.1/mod3.ts?s=Enumerable&amp;p=prototype.concurrentUnorderedMap">.concurrentUnorderedMap()</a>.</p>
<p>To list the <code>s3</code> buckets in your AWS account from terminal:</p>
<pre><code class="language-sh">aws s3 ls
</code></pre>
Expand Down Expand Up @@ -223,7 +223,7 @@ <h1 id="concurrent-processes"><a class="header" href="#concurrent-processes">Con
)
</code></pre>
<p>Use <code>nice</code> because <em>this will eat your server otherwise.</em> The method
<a href="https://deno.land/x/proc@0.21.10/mod3.ts?s=Enumerable&amp;p=prototype.concurrentUnorderedMap">.concurrentUnorderedMap()</a>
<a href="https://deno.land/x/proc@0.22.1/mod3.ts?s=Enumerable&amp;p=prototype.concurrentUnorderedMap">.concurrentUnorderedMap()</a>
will, by default, run one process for each CPU available concurrently until all
work is done.</p>
<p>The result will look something like this:</p>
Expand Down
8 changes: 4 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,21 @@ <h1 class="menu-title">proc</h1>

<div id="content" class="content">
<main>
<h1 id="proc-02110"><a class="header" href="#proc-02110"><code>proc 0.21.10</code></a></h1>
<h1 id="proc-0221"><a class="header" href="#proc-0221"><code>proc 0.22.1</code></a></h1>
<p><code>proc</code> let's you use child processes with
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncIterator"><code>AsyncIterable</code></a>
instead of the streams API, and it includes a library of higher-order functions
for <code>AsyncIterator</code> via
<a href="https://deno.land/x/proc@0.21.10/mod.ts?s=Enumerable"><code>Enumerable</code></a> that
<a href="https://deno.land/x/proc@0.22.1/mod.ts?s=Enumerable"><code>Enumerable</code></a> that
roughly matches what you can do with an array (<code>map</code>, <code>filter</code>, <code>find</code>), but for
asynchronous code.</p>
<p><code>proc</code> simplifies the process of converting a <code>bash</code> script into a Deno
application. The intention is to make writing code that uses lots of IO and
child processes <em>almost</em> as easy as shell scripting, but you also get proper
error handling, type checking, and Deno's security-by-default.</p>
<p><a href="https://deno.land/x/proc@0.21.10/mod.ts">Developer Documentation</a></p>
<p><a href="https://deno.land/x/proc@0.22.1/mod.ts">Developer Documentation</a></p>
<h2 id="usage"><a class="header" href="#usage">Usage</a></h2>
<pre><code class="language-typescript">import { run } from "https://deno.land/x/proc@0.21.10/mod.ts";
<pre><code class="language-typescript">import { run } from "https://deno.land/x/proc@0.22.1/mod.ts";
</code></pre>
<h2 id="a-simple-example"><a class="header" href="#a-simple-example">A Simple Example</a></h2>
<p>Run <code>ls -la</code> as a child process. Decode <code>stdout</code> as lines of text. Print to
Expand Down
8 changes: 4 additions & 4 deletions docs/introduction.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,21 @@ <h1 class="menu-title">proc</h1>

<div id="content" class="content">
<main>
<h1 id="proc-02110"><a class="header" href="#proc-02110"><code>proc 0.21.10</code></a></h1>
<h1 id="proc-0221"><a class="header" href="#proc-0221"><code>proc 0.22.1</code></a></h1>
<p><code>proc</code> let's you use child processes with
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncIterator"><code>AsyncIterable</code></a>
instead of the streams API, and it includes a library of higher-order functions
for <code>AsyncIterator</code> via
<a href="https://deno.land/x/proc@0.21.10/mod.ts?s=Enumerable"><code>Enumerable</code></a> that
<a href="https://deno.land/x/proc@0.22.1/mod.ts?s=Enumerable"><code>Enumerable</code></a> that
roughly matches what you can do with an array (<code>map</code>, <code>filter</code>, <code>find</code>), but for
asynchronous code.</p>
<p><code>proc</code> simplifies the process of converting a <code>bash</code> script into a Deno
application. The intention is to make writing code that uses lots of IO and
child processes <em>almost</em> as easy as shell scripting, but you also get proper
error handling, type checking, and Deno's security-by-default.</p>
<p><a href="https://deno.land/x/proc@0.21.10/mod.ts">Developer Documentation</a></p>
<p><a href="https://deno.land/x/proc@0.22.1/mod.ts">Developer Documentation</a></p>
<h2 id="usage"><a class="header" href="#usage">Usage</a></h2>
<pre><code class="language-typescript">import { run } from "https://deno.land/x/proc@0.21.10/mod.ts";
<pre><code class="language-typescript">import { run } from "https://deno.land/x/proc@0.22.1/mod.ts";
</code></pre>
<h2 id="a-simple-example"><a class="header" href="#a-simple-example">A Simple Example</a></h2>
<p>Run <code>ls -la</code> as a child process. Decode <code>stdout</code> as lines of text. Print to
Expand Down
2 changes: 1 addition & 1 deletion docs/io/read.html
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ <h2 id="reading-from-stdin"><a class="header" href="#reading-from-stdin">Reading
<code>ReadableStream&lt;Uint8Array&gt;</code>. We can wrap this with <code>enumerate(...)</code> to convert
to lines of text (strings).</p>
<p>Text of <code>example.ts</code>:</p>
<pre><code class="language-typescript">import { enumerate } from "https://deno.land/x/proc@0.21.10/mod.ts";
<pre><code class="language-typescript">import { enumerate } from "https://deno.land/x/proc@0.22.1/mod.ts";

for await (const line of enumerate(Deno.stdin.readable).lines) {
console.log(line);
Expand Down
2 changes: 1 addition & 1 deletion docs/misc/sleep.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ <h1 class="menu-title">proc</h1>

<div id="content" class="content">
<main>
<h1 id="sleep"><a class="header" href="#sleep"><a href="https://deno.land/x/proc@0.21.10/mod.ts?s=sleep">sleep</a></a></h1>
<h1 id="sleep"><a class="header" href="#sleep"><a href="https://deno.land/x/proc@0.22.1/mod.ts?s=sleep">sleep</a></a></h1>
<p><code>sleep</code> returns a <code>Promise</code> that resolves after a specified number of
milliseconds.</p>
<pre><code class="language-typescript">console.log("Program starts");
Expand Down
42 changes: 21 additions & 21 deletions docs/print.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,21 +174,21 @@ <h1 class="menu-title">proc</h1>

<div id="content" class="content">
<main>
<h1 id="proc-02110"><a class="header" href="#proc-02110"><code>proc 0.21.10</code></a></h1>
<h1 id="proc-0221"><a class="header" href="#proc-0221"><code>proc 0.22.1</code></a></h1>
<p><code>proc</code> let's you use child processes with
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncIterator"><code>AsyncIterable</code></a>
instead of the streams API, and it includes a library of higher-order functions
for <code>AsyncIterator</code> via
<a href="https://deno.land/x/proc@0.21.10/mod.ts?s=Enumerable"><code>Enumerable</code></a> that
<a href="https://deno.land/x/proc@0.22.1/mod.ts?s=Enumerable"><code>Enumerable</code></a> that
roughly matches what you can do with an array (<code>map</code>, <code>filter</code>, <code>find</code>), but for
asynchronous code.</p>
<p><code>proc</code> simplifies the process of converting a <code>bash</code> script into a Deno
application. The intention is to make writing code that uses lots of IO and
child processes <em>almost</em> as easy as shell scripting, but you also get proper
error handling, type checking, and Deno's security-by-default.</p>
<p><a href="https://deno.land/x/proc@0.21.10/mod.ts">Developer Documentation</a></p>
<p><a href="https://deno.land/x/proc@0.22.1/mod.ts">Developer Documentation</a></p>
<h2 id="usage"><a class="header" href="#usage">Usage</a></h2>
<pre><code class="language-typescript">import { run } from "https://deno.land/x/proc@0.21.10/mod.ts";
<pre><code class="language-typescript">import { run } from "https://deno.land/x/proc@0.22.1/mod.ts";
</code></pre>
<h2 id="a-simple-example"><a class="header" href="#a-simple-example">A Simple Example</a></h2>
<p>Run <code>ls -la</code> as a child process. Decode <code>stdout</code> as lines of text. Print to
Expand Down Expand Up @@ -236,7 +236,7 @@ <h2 id="a-better-example"><a class="header" href="#a-better-example">A Better Ex
one buffer, one line, or one word at a time.</p>
<div style="break-before: page; page-break-before: always;"></div><h1 id="running-a-process"><a class="header" href="#running-a-process">Running a Process</a></h1>
<p><code>proc</code> lets you run a process from Deno with as little boilerplate as possible.</p>
<pre><code class="language-typescript">import { run } from "https://deno.land/x/proc@0.21.10/mod.ts";
<pre><code class="language-typescript">import { run } from "https://deno.land/x/proc@0.22.1/mod.ts";
</code></pre>
<p>To <code>ls -la</code>:</p>
<pre><code class="language-typescript">await run("ls", "-la").toStdout();
Expand All @@ -245,12 +245,12 @@ <h2 id="a-better-example"><a class="header" href="#a-better-example">A Better Ex
<pre><code class="language-typescript">const lines: string[] = await run("ls", "-la").lines.collect();
</code></pre>
<h2 id="create-a-command-programmatically"><a class="header" href="#create-a-command-programmatically">Create a Command Programmatically</a></h2>
<pre><code class="language-typescript">import { Cmd, run } from "https://deno.land/x/proc@0.21.10/mod.ts";
<pre><code class="language-typescript">import { Cmd, run } from "https://deno.land/x/proc@0.22.1/mod.ts";
</code></pre>
<p>A command requires that the first parameter be defined, and that it be either a
string or a URL. Additional parameters are string values. This doesn't quite fit
the signature of an array. Use
<a href="https://deno.land/x/proc@0.21.10/mod.ts?s=Cmd">Cmd</a> as the type of the array.
<a href="https://deno.land/x/proc@0.22.1/mod.ts?s=Cmd">Cmd</a> as the type of the array.
This can be spread into <code>run</code>.</p>
<pre><code class="language-typescript">// Assume options.all is a defined boolean.

Expand Down Expand Up @@ -334,11 +334,11 @@ <h2 id="create-a-command-programmatically"><a class="header" href="#create-a-com
<ul>
<li>all process <code>stderr</code> will be written to <code>Deno.stderr</code></li>
<li>any exit code other than 0 will throw an
<a href="https://deno.land/x/proc@0.21.10/mod.ts?s=ExitCodeError"><code>ExitCodeError</code></a></li>
<a href="https://deno.land/x/proc@0.22.1/mod.ts?s=ExitCodeError"><code>ExitCodeError</code></a></li>
<li>if the process ends due to a signal, it will throw a
<a href="https://deno.land/x/proc@0.21.10/mod.ts?s=SignalError"><code>SignalError</code></a></li>
<a href="https://deno.land/x/proc@0.22.1/mod.ts?s=SignalError"><code>SignalError</code></a></li>
<li>an error coming from upstream (<code>stdin</code>) will be wrapped in an
<a href="https://deno.land/x/proc@0.21.10/mod.ts?s=UpstreamError"><code>UpstreamError</code></a></li>
<a href="https://deno.land/x/proc@0.22.1/mod.ts?s=UpstreamError"><code>UpstreamError</code></a></li>
</ul>
<p>While the default behaviors are usually adequate, these can be overridden. There
is no standard for standard error, so it may take some effort to get the results
Expand Down Expand Up @@ -381,7 +381,7 @@ <h2 id="reading-from-stdin"><a class="header" href="#reading-from-stdin">Reading
<code>ReadableStream&lt;Uint8Array&gt;</code>. We can wrap this with <code>enumerate(...)</code> to convert
to lines of text (strings).</p>
<p>Text of <code>example.ts</code>:</p>
<pre><code class="language-typescript">import { enumerate } from "https://deno.land/x/proc@0.21.10/mod.ts";
<pre><code class="language-typescript">import { enumerate } from "https://deno.land/x/proc@0.22.1/mod.ts";

for await (const line of enumerate(Deno.stdin.readable).lines) {
console.log(line);
Expand Down Expand Up @@ -431,7 +431,7 @@ <h2 id="the-cost-of-iteration"><a class="header" href="#the-cost-of-iteration">T
<p><a href="https://madelinemiller.dev/blog/javascript-promise-overhead/">The Performance Overhead of JavaScript Promises and Async Await</a>
shows a couple of examples that isolate the performance difference to overhead
due to promises.</p>
<div style="break-before: page; page-break-before: always;"></div><h1 id="sleep"><a class="header" href="#sleep"><a href="https://deno.land/x/proc@0.21.10/mod.ts?s=sleep">sleep</a></a></h1>
<div style="break-before: page; page-break-before: always;"></div><h1 id="sleep"><a class="header" href="#sleep"><a href="https://deno.land/x/proc@0.22.1/mod.ts?s=sleep">sleep</a></a></h1>
<p><code>sleep</code> returns a <code>Promise</code> that resolves after a specified number of
milliseconds.</p>
<pre><code class="language-typescript">console.log("Program starts");
Expand All @@ -453,22 +453,22 @@ <h2 id="utf-8-lines"><a class="header" href="#utf-8-lines"><code>UTF-8</code> Li
<p>This is the "normal" way to work with line-delimited text. It should be a good
solution most of the time.</p>
<p>The
<a href="https://deno.land/x/proc@0.21.10/mod3.ts?s=ProcessEnumerable#accessor_lines">lines</a>
<a href="https://deno.land/x/proc@0.22.1/mod3.ts?s=ProcessEnumerable#accessor_lines">lines</a>
method converts a line at a time.</p>
<pre><code class="language-typescript">await run("ls", "-la")
.lines
.forEach((it) =&gt; console.log(it));
</code></pre>
<p>Alternately you can use
<a href="https://deno.land/x/proc@0.21.10/mod3.ts?s=Enumerable#method_transform_0">transform</a>
with the <a href="https://deno.land/x/proc@0.21.10/mod3.ts?s=toLines">toLines</a>
<a href="https://deno.land/x/proc@0.22.1/mod3.ts?s=Enumerable#method_transform_0">transform</a>
with the <a href="https://deno.land/x/proc@0.22.1/mod3.ts?s=toLines">toLines</a>
transformer function.</p>
<pre><code class="language-typescript">await read(resolve("./warandpeace.txt.gz"))
.transform(toLines)
.forEach((it) =&gt; console.log(it));
</code></pre>
<p>The
<a href="https://deno.land/x/proc@0.21.10/mod3.ts?s=Enumerable#method_run_0">Enumerable.run</a>
<a href="https://deno.land/x/proc@0.22.1/mod3.ts?s=Enumerable#method_run_0">Enumerable.run</a>
method will automatically treat <code>string</code> values as lines, adding <code>\n</code> to them
and converting back into <code>utf-8</code> encoded bytes.</p>
<p>Note that this <em>always</em> assumes string data passed to it is line-delimited. If
Expand Down Expand Up @@ -523,13 +523,13 @@ <h2 id="not-all-text-data-is-text-data"><a class="header" href="#not-all-text-da
</code></pre>
<div style="break-before: page; page-break-before: always;"></div><h2 id="transformers"><a class="header" href="#transformers">Transformers</a></h2>
<p><code>proc</code> ships with some useful
<a href="https://deno.land/x/proc@0.21.10/src/transformers.ts">transformers</a>.</p>
<a href="https://deno.land/x/proc@0.22.1/src/transformers.ts">transformers</a>.</p>
<p>A transformer is a <em>plain-old JavaScript function</em> with this signature:</p>
<pre><code class="language-typescript">type Transformer&lt;T, U&gt; = (it: AsyncIterable&lt;T&gt;) =&gt; AsyncIterable&lt;U&gt;;
</code></pre>
<p>Transformers are functions (and may be defined using asynchronous generator
functions). You can compose them into new functions relatively easily. The
<a href="https://deno.land/x/proc@0.21.10/mod3.ts?s=Enumerable#method_transform_0">transform</a>
<a href="https://deno.land/x/proc@0.22.1/mod3.ts?s=Enumerable#method_transform_0">transform</a>
operation is like <code>pipeThrough</code> in streaming.</p>
<p>A transformer transforms objects from one type to another. It is like <code>map</code> but
with with complete control over the whole stream of data - including control
Expand Down Expand Up @@ -740,9 +740,9 @@ <h3 id="putting-it-all-together"><a class="header" href="#putting-it-all-togethe
most storage. <code>proc</code> makes it possible to run <code>ls --summarize</code> with parallelism
matching the number of CPU cores available (or whatever concurrency you
specify). The specific methods that support concurrent operations are
<a href="https://deno.land/x/proc@0.21.10/mod3.ts?s=Enumerable&amp;p=prototype.concurrentMap">.concurrentMap()</a>
<a href="https://deno.land/x/proc@0.22.1/mod3.ts?s=Enumerable&amp;p=prototype.concurrentMap">.concurrentMap()</a>
and
<a href="https://deno.land/x/proc@0.21.10/mod3.ts?s=Enumerable&amp;p=prototype.concurrentUnorderedMap">.concurrentUnorderedMap()</a>.</p>
<a href="https://deno.land/x/proc@0.22.1/mod3.ts?s=Enumerable&amp;p=prototype.concurrentUnorderedMap">.concurrentUnorderedMap()</a>.</p>
<p>To list the <code>s3</code> buckets in your AWS account from terminal:</p>
<pre><code class="language-sh">aws s3 ls
</code></pre>
Expand Down Expand Up @@ -782,7 +782,7 @@ <h3 id="putting-it-all-together"><a class="header" href="#putting-it-all-togethe
)
</code></pre>
<p>Use <code>nice</code> because <em>this will eat your server otherwise.</em> The method
<a href="https://deno.land/x/proc@0.21.10/mod3.ts?s=Enumerable&amp;p=prototype.concurrentUnorderedMap">.concurrentUnorderedMap()</a>
<a href="https://deno.land/x/proc@0.22.1/mod3.ts?s=Enumerable&amp;p=prototype.concurrentUnorderedMap">.concurrentUnorderedMap()</a>
will, by default, run one process for each CPU available concurrently until all
work is done.</p>
<p>The result will look something like this:</p>
Expand Down
6 changes: 3 additions & 3 deletions docs/process-run.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ <h1 class="menu-title">proc</h1>
<main>
<h1 id="running-a-process"><a class="header" href="#running-a-process">Running a Process</a></h1>
<p><code>proc</code> lets you run a process from Deno with as little boilerplate as possible.</p>
<pre><code class="language-typescript">import { run } from "https://deno.land/x/proc@0.21.10/mod.ts";
<pre><code class="language-typescript">import { run } from "https://deno.land/x/proc@0.22.1/mod.ts";
</code></pre>
<p>To <code>ls -la</code>:</p>
<pre><code class="language-typescript">await run("ls", "-la").toStdout();
Expand All @@ -184,12 +184,12 @@ <h1 id="running-a-process"><a class="header" href="#running-a-process">Running a
<pre><code class="language-typescript">const lines: string[] = await run("ls", "-la").lines.collect();
</code></pre>
<h2 id="create-a-command-programmatically"><a class="header" href="#create-a-command-programmatically">Create a Command Programmatically</a></h2>
<pre><code class="language-typescript">import { Cmd, run } from "https://deno.land/x/proc@0.21.10/mod.ts";
<pre><code class="language-typescript">import { Cmd, run } from "https://deno.land/x/proc@0.22.1/mod.ts";
</code></pre>
<p>A command requires that the first parameter be defined, and that it be either a
string or a URL. Additional parameters are string values. This doesn't quite fit
the signature of an array. Use
<a href="https://deno.land/x/proc@0.21.10/mod.ts?s=Cmd">Cmd</a> as the type of the array.
<a href="https://deno.land/x/proc@0.22.1/mod.ts?s=Cmd">Cmd</a> as the type of the array.
This can be spread into <code>run</code>.</p>
<pre><code class="language-typescript">// Assume options.all is a defined boolean.

Expand Down
Loading

0 comments on commit f1e8084

Please sign in to comment.