binaryview

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

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. We check multiple sources in order: 1. Content-Disposition header (server's explicit suggestion) 2. URL path (often contains the actual filename) 3. MIME type (to at least get the right extension) 4. Fall back to "response.bin" if all else fails

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