std/io¶
module io
Input and output: endpoints, the data sources read from them, and the
data targets written to them. An endpoint names where bytes are and
performs no I/O; a format type (module format) states how the bytes are
documents; a source or target joins the two, and Seq and Stream state
whether the documents end.
Endpoint— The abstract type of every endpoint: where bytes are.Readable— An endpoint bytes can be read from, bysourceandtap.Replayable— AReadableendpoint that gives the same bytes on every read in one evaluation, sosourcereads what it holds as aSeq.Writable— An endpoint bytes can be written to, bytargetandsink.Stdin— The program's standard input, bound asstdin: read once, as it arrives.Stdout— The program's standard output, bound asstdout: written while the program runs, before the host presents its result.Stderr— The program's standard error, bound asstderr: where diagnostics go, apart from the result.FileEnd— The end of a file, after what it holds, asfile(path).end: a write there appends, andtapfollows what is written next, astail -fdoes.File— A local file, the whole of it: read, every document it holds; written, it is replaced.Channel— An endpoint of values rather than bytes, held in memory for one execution scope: a program run, or one cell.DataSource— What a program reads: a configured source by id, or an endpoint read in a format.FiniteSource— A source of every document, in order, that ends: read from aReplayableendpoint.LiveSource— A source of each document as it arrives, with no replay: read from a live endpoint.KeyedSource— A finite source whose contents are addressable by a key of typeK.Position— A message's place in its log, ordered as the log is.Message— One element of a stream with where and when it sits in it: itsvalue, itsposition, an optionalkeyandtime, and itsheaders.StreamSource— A log:Message<T>s in order, replayable within its retention.Catalog— An endpoint that contains sources of typeS: a database of tables, a cluster of topics.VaultSource— A vault as a source: an endpoint that holds its cards, as a catalog holds tables, with its members as fields rather than names.DataTarget— What a program writes to: an endpoint written in a format, or a configured target by its id.file— TheFileatpath.source— Every document read fromendpointinformat, decoded toT: aSeqfrom aReplayableendpoint, aStreamfrom a live one.tap— The documents read fromendpointinformat, one held at a time, as aStream<T>.target— Writesvalueas one document toendpointinformat, or to the target configured underid, and givesUnit.sink— Writes each ofvaluestoendpointinformat, one document per value, and givesUnit:[{a: 1}, {a: 2}] | sink(stdout, Json)writes{"a":1}and{"a":2}on two lines.