Skip to content

Batch output sinks (ndjson stdout + per-item files)#26

Open
paulius-krutkis-dcd wants to merge 1 commit into
batch-executorfrom
batch-output
Open

Batch output sinks (ndjson stdout + per-item files)#26
paulius-krutkis-dcd wants to merge 1 commit into
batch-executorfrom
batch-output

Conversation

@paulius-krutkis-dcd

Copy link
Copy Markdown
Collaborator

Part 3 of 4 for the batch-input feature. Builds on batch-executor.

Adds the two batch output destinations on top of the executor (part 2):

  • createNdjsonStdoutSink — one JSON record per line on stdout, regardless of TTY (the batch default).
  • createDirectorySink — one <name>.json file per item into a directory (created if needed); names derived from the input URL slug or row index, deduped on collision.

Both share toBatchRecord, so a record is identical whether streamed or written to a file — successes carry result, failures carry error.

Based on batch-executor — review/merge part 2 first.

Stack: 1/4 batch-input-parsing → 2/4 batch-executor → 3/4 (this) → 4/4 wire-batch-flags

Add the two batch output destinations on top of the executor:

- createNdjsonStdoutSink: one JSON record per line on stdout, regardless
  of TTY (the batch default).
- createDirectorySink: one <name>.json file per item into a directory
  (created if needed); names derived from the input URL slug or row
  index via batchItemFilename, deduped on collision.

Both share toBatchRecord so a record looks identical whether streamed or
written to a file. Successes carry `result`, failures carry `error`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant