from msgpack
for formats
Convert MessagePack data into Nu values.
Signature
> from msgpack {flags}
Flags
--objects
: Read multiple objects from input
Input/output types:
input | output |
---|---|
binary | any |
Examples
Read a list of values from MessagePack
> 0x[93A3666F6F2AC2] | from msgpack
╭───┬───────╮
│ 0 │ foo │
│ 1 │ 42 │
│ 2 │ false │
╰───┴───────╯
Read a stream of multiple values from MessagePack
> 0x[81A76E757368656C6CA5726F636B73A9736572696F75736C79] | from msgpack --objects
╭───┬─────────────────────╮
│ 0 │ ╭─────────┬───────╮ │
│ │ │ nushell │ rocks │ │
│ │ ╰─────────┴───────╯ │
│ 1 │ seriously │
╰───┴─────────────────────╯
Read a table from MessagePack
> 0x[9282AA6576656E745F6E616D65B141706F6C6C6F203131204C616E64696E67A474696D65C70CFF00000000FFFFFFFFFF2CAB5B82AA6576656E745F6E616D65B44E757368656C6C20666972737420636F6D6D6974A474696D65D6FF5CD5ADE0] | from msgpack
╭───┬──────────────────────┬──────────────╮
│ # │ event_name │ time │
├───┼──────────────────────┼──────────────┤
│ 0 │ Apollo 11 Landing │ 55 years ago │
│ 1 │ Nushell first commit │ 5 years ago │
╰───┴──────────────────────┴──────────────╯
Notes
Not all values are representable as MessagePack.
The datetime extension type is read as dates. MessagePack binary values are read to their Nu equivalent. Most other types are read in an analogous way to from json
, and may not convert to the exact same type if to msgpack
was used originally to create the data.
MessagePack: https://msgpack.org/