Ports #
A sink: it has no outputs.
| Port | Direction | Kind | Required | Description |
|---|---|---|---|---|
in | input | records | yes |
Parameters #
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
path | string | none | yes | |
append | boolean | false | no |
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.writegrant that coverspath, 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.
{
"path": "some-output.ndjson"
}1Expected 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:
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.
openflange run pipeline.yaml --grant fs.write=./outpath 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
- Normative definition: std:file-source, std:file-sink in the standard library specification
- Manifest and tests: std/0.1/file-sink in the specification repository