bytes

command module
v0.0.0-...-84999ea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2023 License: MIT Imports: 10 Imported by: 0

README

bytes is a small utility for working with small binary artifacts

It converts between programming-language syntax for byte arrays and actual binary. This is primarily useful if you're trying to debug or modify something you have the bits for using a text editor, or if you have a test fixture inline in the tests you want to extract to binary.

To install:

go install github.com/ConradIrwin/bytes@latest

To use:

usage: bytes [-d|--decode|--rust|--go] <file>?

bytes formats binary input as a []byte{} array for use in go code, or a vec![] for rust.

If no file name is provided, bytes reads from stdin

If -d or --decode is passed the transformation is reversed, and formatted bytes
are output as binary. Supported input formats are valid go []bytes{} and rust
vec![]'s.  Care is taken to remove comments, spaces, semicolons, etc. so you can
paste directly from code.  As a special case bytes can also decode go fuzz fixture files
containing bytes.
  -d
  -decode
    	decode formatted bytes and output binary
  -go
    	output in go syntax (default)
  -rust
    	output in rust syntax

Bug reports and pull requests welcome!

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL