https://github.com/wherrera10/baseddumps.jl
Binary memory or file dumpers in base 2 through 16 formats
https://github.com/wherrera10/baseddumps.jl
Last synced: 4 months ago
JSON representation
Binary memory or file dumpers in base 2 through 16 formats
- Host: GitHub
- URL: https://github.com/wherrera10/baseddumps.jl
- Owner: wherrera10
- License: mit
- Created: 2023-10-31T09:40:05.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-04T07:17:10.000Z (almost 2 years ago)
- Last Synced: 2025-06-22T19:07:04.755Z (4 months ago)
- Language: Julia
- Homepage:
- Size: 64.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BasedDumps.jl
Binary memory and file dumpers in base 2 through 16 formats
## Functions:
### function baseddump
5 methods.
### function baseddump(io::IO, data::Vector{UInt8}; base = 16, offset = 0, len = -1)
### function baseddump(io::IO, data::AbstractArray; base = 16, offset = 0, len = -1)
### function baseddump(data; base = 16, offset = 0, len = -1)Print (to stdout, or if specified io) a dump of `data`. The function will attempt
to convert non-UInt8 data to a vector of UInt8 bytes. If a string is passed for
data, the function will interpret this as a file name for the data, so for string
data textdump() should be used, as shown below. The portion of data that is
dumped defaults to all of data, or else, if specified, from `offset` to `len`.
The `offset` is printed as the first hex numeric entry on the left, and the final
count of bytes dumped is printed as the last hex number on the left.
The `base` used to print the data is between 16 (default) and 2 (binary).
The data is formatted similar to the format of the unix utilities `hexdump` or
`xxd` for bases 16 and 2, the decimal format for `base` 10 is similar to unix
`hexdump` but with decimal format and similarly for base 8 and octal format.
Any base between 2 and 16 is supported, but there are shorter function names
for base 2 (binary), base 8 (octal), base 10 (decimal), and the default 16
(hexadecimal).### function baseddump(to::IO, from::IO; base = 16, offset = 0, len = -1)
### function baseddump(to::IO, filename::AbstractString; base = 16, offset = 0, len = -1)Print (to stdout, or if specified to the IO `to`) a dump of the stream `from` or file
`filename` as bytes. The portion dumped defaults to all of the data until eof(),
or else, if specified, from `offset` to `len`.Note that these functions have shorter versions:
`hexdump` which defaults to base 16,
`xxd` which defaults to base 2,
`octdump` which defaults to base 8, and
`decdump` which defaults to base 10.
#### Examples:
hexdump("test.so") will dump the contents of file "test.so" as a hex display to stdout.
xxd(stderr, s, offset = 16, length = 1008) will dump the bytes in s[16:16+1008-1], where s
is a vector of bytes, to stderr in a binary format.
### textdump(io::IO, txt::AbstractString; base = 16, off = 0, len = -1)
Dump (with `baseddump`) the string `txt`. Julia strings will be interpreted
as utf-8 text, with mulitbyte chars displayed in little endian order.### textdump(txt; base = 16, offset = 0, len = -1)
This method is the same as the previous method of that name, but dumps only to stdout.