Skip to content
Snippets Groups Projects

bump to Nushell 0.95.0

Merged STEVAN Antoine requested to merge fix-nushell-0_94_2 into main
2 files
+ 1
20
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 0
13
# decode a list of integer bytes into the underlying encoded string
export def "bytes decode" [encoding: string = "utf-8"]: list<int> -> string {
each { into binary | bytes at 0..1 } | bytes collect | decode $encoding
}
# encode an encoded string into the underlying list of integer bytes
export def "bytes encode" [encoding: string = "utf-8"]: string -> list<int> {
let bytes = $in | encode $encoding
seq 1 ($bytes | bytes length) | each {|i|
$bytes | bytes at ($i - 1)..($i) | into int
}
}
export def "bytes from_int" []: [int -> binary, list<int> -> binary] {
each { into binary --compact } | bytes collect
}