metadata access
for debug
Access the metadata for the input stream within a closure.
Signature
> metadata access {flags} (closure)
Parameters
closure
: The closure to run with metadata access.
Input/output types:
input | output |
---|---|
any | any |
Examples
Access metadata and data from a stream together
> {foo: bar} | to json --raw | metadata access {|meta| {in: $in, meta: $meta}}
╭──────┬─────────────────────────────────────╮
│ in │ {"foo":"bar"} │
│ │ ╭──────────────┬──────────────────╮ │
│ meta │ │ content_type │ application/json │ │
│ │ ╰──────────────┴──────────────────╯ │
╰──────┴─────────────────────────────────────╯