to msgpack
for formats
Convert Nu values into MessagePack.
Signature
> to msgpack {flags}
Input/output types:
input | output |
---|---|
any | binary |
Examples
Convert a list of values to MessagePack
> [foo, 42, false] | to msgpack
Length: 7 (0x7) bytes | printable whitespace ascii_other non_ascii
00000000: 93 a3 66 6f 6f 2a c2 ××foo*×
Convert a range to a MessagePack array
> 1..10 | to msgpack
Length: 11 (0xb) bytes | printable whitespace ascii_other non_ascii
00000000: 9a 01 02 03 04 05 06 07 08 09 0a ו•••••••__
Convert a table to MessagePack
> [
[event_name time];
['Apollo 11 Landing' 1969-07-24T16:50:35]
['Nushell first commit' 2019-05-10T09:59:12-07:00]
] | to msgpack
Length: 95 (0x5f) bytes | printable whitespace ascii_other non_ascii
00000000: 92 82 aa 65 76 65 6e 74 5f 6e 61 6d 65 b1 41 70 ×××event_name×Ap
00000010: 6f 6c 6c 6f 20 31 31 20 4c 61 6e 64 69 6e 67 a4 ollo 11 Landing×
00000020: 74 69 6d 65 c7 0c ff 00 00 00 00 ff ff ff ff ff time×_×0000×××××
00000030: 2c ab 5b 82 aa 65 76 65 6e 74 5f 6e 61 6d 65 b4 ,×[××event_name×
00000040: 4e 75 73 68 65 6c 6c 20 66 69 72 73 74 20 63 6f Nushell first co
00000050: 6d 6d 69 74 a4 74 69 6d 65 d6 ff 5c d5 ad e0 mmit×time××\×××
Notes
Not all values are representable as MessagePack.
The datetime extension type is used for dates. Binaries are represented with the native MessagePack binary type. Most other types are represented in an analogous way to to json
, and may not convert to the exact same type when deserialized with from msgpack
.
MessagePack: https://msgpack.org/