W3cubDocs

/Nushell

into bits for conversions

Convert value to a binary primitive.

Signature

> into bits {flags} ...rest

Parameters

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

Input/output types:

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

Examples

convert a binary value into a string, padded to 8 places with 0s

>01b|into bits
00000001

convert an int into a string, padded to 8 places with 0s

>1|into bits
00000001

convert a filesize value into a string, padded to 8 places with 0s

>1b|into bits
00000001

convert a duration value into a string, padded to 8 places with 0s

>1ns|into bits
00000001

convert a boolean value into a string, padded to 8 places with 0s

>true|into bits
00000001

convert a datetime value into a string, padded to 8 places with 0s

>2023-04-17T01:02:03|into bits
010011010110111101101110001000000100000101110000011100100010000000110001001101110010000000110000001100010011101000110000001100100011101000110000001100110010000000110010001100000011001000110011

convert a string into a raw binary string, padded with 0s to 8 places

>'nushell.sh'|into bits
01101110011101010111001101101000011001010110110001101100001011100111001101101000

Tips: Command into bits was not included in the official binaries by default, you have to build it with --features=extra flag

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