Different pipes. One standard.

Type to search this site.

Search runs in your browser against a static index built with this site (Pagefind). Nothing you type is sent to a server.

LoadExperimental

std:file-sink #

Sink: an NDJSON file. Needs a filesystem.write grant covering path.

For example: write results to an NDJSON file.

A pipe is a data processing step with declared inputs and outputs; standard pipes are built into the runner.

Ports #

std:file-sink takes in and produces no outputs.std:file-sinkinrecords
std:file-sink takes in and produces no outputs.std:file-sinkinrecords
Named ports from the latest published contract. Dashed lines are optional ports.

A sink: it has no outputs.

Ports of std:file-sink
PortDirectionKindRequiredDescription
ininputrecordsyes

Parameters #

Parameters of std:file-sink
NameTypeDefaultRequiredDescription
pathstringnoneyes
appendbooleanfalseno

When to use it #

  • Keep the result of a pipeline at a fixed path; the file is created, or its previous content replaced.
  • Add to a log of results on every run with append: true.

When to use something else

  • The node needs a filesystem.write grant that covers path, and it does not create parent directories. Output is not transactional: a failed run can leave a partly written file, and the run report says so.

A tested example #

Nothing here is invented: this is the test “writing without a filesystem grant is refused” from the pipe's own portable test file, which every conformant runner must pass.

Parameters
{
  "path": "some-output.ndjson"
}
Input: in
1
Expected output: —

Expected result: the run fails with E_PERMISSION. Nothing is written to the outputs.

The test grants the node no permissions.

The same step as a node of a pipeline.yaml:

pipeline.yaml
nodes:
  file-sink:
    pipe: std:file-sink
    inputs:
      in: {from: inputs.in}
    parameters:
      path: "some-output.ndjson"

Written like this, the node is refused, exactly as in the test: it needs a grant.

Notes from the manifest #

The pipe's manifest, OPENFLANGE.md, carries these notes.

Part of the OpenFlange standard library (std, version 0.1).

A sink that writes every item as one NDJSON line (final newline included) to path. The file is created with mode 0644 if needed and truncated unless append: true. Parent directories are not created. Items are copied byte-for-byte.

No rollback. Writes are buffered and flushed at end of stream and on failure. If the run fails or is cancelled, the file keeps whatever was written up to that point; the run report's terminal state and partialOutput are authoritative.

Permission #

The permission this pipe needs depends on its path parameter, which a static manifest cannot express; it is a dynamic permission requirement of the standard library: filesystem.write covering path. The consumer must grant it and the runner enforces it — a granted path covers itself and, for a directory, everything beneath it, after both are made absolute and symbolic links are resolved. Without a covering grant the run is refused with E_PERMISSION before the file is touched.

sh
openflange run pipeline.yaml --grant fs.write=./out

path must be a literal or a $param binding. A relative path resolves against the directory of the pipeline file that contains the node (the working directory when the pipe is run directly).

Reference #

Maturity
Experimental
Manifest version
0.1.0