binaryview

package
v0.23.6 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// default number of bytes shown per line in hex dumps.
	HexDumpBytesPerLine = 16
)

Variables

This section is empty.

Functions

func Base64Lines

func Base64Lines(body []byte, width int) string

Base64Lines wraps base64 output at a given width. Long base64 strings are unreadable and break terminal rendering, so we chunk them into lines like PEM files do.

func DecodeText

func DecodeText(body []byte, charsetLabel string) (string, bool, string)

func FilenameHint

func FilenameHint(disposition, rawURL, mimeType string) string

FilenameHint tries to figure out a good filename for saving a response. Order: 1) Content-Disposition header 2) URL path 3) MIME type extension 4) Fallback to "response.bin"

func HexDump

func HexDump(body []byte, bytesPerLine int) string

func HexPreview

func HexPreview(body []byte) string

Types

type Kind

type Kind int
const (
	KindUnknown Kind = iota
	KindText
	KindBinary
)

type Meta

type Meta struct {
	Kind       Kind
	MIME       string
	Charset    string
	Size       int
	Printable  bool
	DecodeErr  string
	PreviewHex string
	PreviewB64 string
}

func Analyze

func Analyze(body []byte, contentType string) Meta

Jump to

Keyboard shortcuts

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