Spec-Zone.ru › Nushell

into binary for conversions

Convert value to a binary primitive.

Signature

> into binary {flags} ...rest

Flags

  • --compact, -c: Output without padding zeros.
  • --endian, -e {string}: Byte encode endian. Does not affect string, date or binary. In containers, only individual elements are affected. Available options: native(default), little, big.

Parameters

  • ...rest: For a data structure input, convert data at the given cell paths.

Input/output types:

input output
binary binary
int binary
number binary
string binary
bool binary
filesize binary
datetime binary
table table
record record

Examples

convert string to a nushell binary primitive.

> 'This is a string that is exactly 52 characters long.' | into binary
Length: 52 (0x34) bytes | null_char printable whitespace ascii_other non_ascii
00000000:   54 68 69 73  20 69 73 20  61 20 73 74  72 69 6e 67   This is a string
00000010:   20 74 68 61  74 20 69 73  20 65 78 61  63 74 6c 79    that is exactly
00000020:   20 35 32 20  63 68 61 72  61 63 74 65  72 73 20 6c    52 characters l
00000030:   6f 6e 67 2e                                          ong.

convert a number to a nushell binary primitive.

> 1 | into binary
Length: 8 (0x8) bytes | null_char printable whitespace ascii_other non_ascii
00000000:   01 00 00 00  00 00 00 00                             •0000000

convert a number to a nushell binary primitive (big endian).

> 258 | into binary --endian big
Length: 8 (0x8) bytes | null_char printable whitespace ascii_other non_ascii
00000000:   00 00 00 00  00 00 01 02                             000000••

convert a number to a nushell binary primitive (little endian).

> 258 | into binary --endian little
Length: 8 (0x8) bytes | null_char printable whitespace ascii_other non_ascii
00000000:   02 01 00 00  00 00 00 00                             ••000000

convert a boolean to a nushell binary primitive.

> true | into binary
Length: 8 (0x8) bytes | null_char printable whitespace ascii_other non_ascii
00000000:   01 00 00 00  00 00 00 00                             •0000000

convert a filesize to a nushell binary primitive.

> ls | where name == LICENSE | get size | into binary

convert a filepath to a nushell binary primitive.

> ls | where name == LICENSE | get name | path expand | into binary

convert a float to a nushell binary primitive.

> 1.234 | into binary
Length: 8 (0x8) bytes | null_char printable whitespace ascii_other non_ascii
00000000:   58 39 b4 c8  76 be f3 3f                             X9××v××?

convert an int to a nushell binary primitive with compact enabled.

> 10 | into binary --compact
Length: 1 (0x1) bytes | null_char printable whitespace ascii_other non_ascii
00000000:   0a                                                   _

Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/into_binary.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API