W3cubDocs

/Nushell

into binary for conversions

Convert value to a binary primitive.

Signature

> into binary {flags} ...rest

Flags

  • --compact, -c: output without padding zeros

Parameters

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

Input/output types:

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

Examples

convert string to a nushell binary primitive

>'This is a string that is exactly 52 characters long.'|into binary
Length:52 (0x34) bytes|printablewhitespaceascii_othernon_ascii
00000000:54686973206973206120737472696e67Thisisastring
00000010:20746861742069732065786163746c79thatisexactly
00000020:2035322063686172616374657273206c52charactersl
00000030:6f6e672eong.

convert a number to a nushell binary primitive

>1|into binary
Length:8 (0x8) bytes|printablewhitespaceascii_othernon_ascii
00000000:0100000000000000•0000000

convert a boolean to a nushell binary primitive

>true|into binary
Length:8 (0x8) bytes|printablewhitespaceascii_othernon_ascii
00000000:0100000000000000•0000000

convert a filesize to a nushell binary primitive

>ls|wherename==LICENSE|getsize|into binary

convert a filepath to a nushell binary primitive

>ls|wherename==LICENSE|getname|path expand|into binary

convert a float to a nushell binary primitive

>1.234|into binary
Length:8 (0x8) bytes|printablewhitespaceascii_othernon_ascii
00000000:5839b4c876bef33fX9××v××?

convert an integer to a nushell binary primitive with compact enabled

>10|into binary--compact
Length:1 (0x1) bytes|printablewhitespaceascii_othernon_ascii
00000000:0a_

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