metadata access

For debug.

Access the metadata for the input stream within a closure.

Command Type

built-in

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, content: $meta.content_type}}
╭─────────┬──────────────────╮
│ in      │ {"foo":"bar"}    │
│ content │ application/json │
╰─────────┴──────────────────╯

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.