Documentation
ΒΆ
Overview ΒΆ
Copied from https://github.com/go-yenc/yenc and enhanced with more robust parsing and error handling. The original license is MIT.
Index ΒΆ
Constants ΒΆ
This section is empty.
Variables ΒΆ
View Source
var BufferLimit = 256 * 1024
Max number of bytes per line (ends in LF and includes the LF) when decoding yEnc data stream. Set to 256 KiB so the ring buffer can hold many complete yEnc lines, avoiding boundary issues that caused stalling with the original 4 KiB default.
View Source
var ErrBufferTooSmall = errors.New("buffer too small")
View Source
var ErrDataCorruption = errors.New("data corruption detected")
View Source
var ErrInvalidFormat = errors.New("not a valid yEncode formatted data stream")
View Source
var ErrRejectPrefixData = errors.New("yEncode not started at the beginning of the data stream")
View Source
var LineLimit uint64 = 128
Max number of bytes per line (ends in LF but NOT include the LF) when encoding yEnc data stream. Default is 128 which is a commonly acceptable limit for probably all known NNTP and yEncode implementations.
Functions ΒΆ
func ApplyOption ΒΆ
func ApplyOption[T any, O ~func(*T)](opts *T, options []O, defaults ...O) *T
Types ΒΆ
type DecodeOption ΒΆ
type DecodeOption func(*Decoder)
func DecodeWithBuffer ΒΆ
func DecodeWithBuffer(b []byte) DecodeOption
func DecodeWithBufferSize ΒΆ
func DecodeWithBufferSize(size int) DecodeOption
func DecodeWithPrefixData ΒΆ
func DecodeWithPrefixData() DecodeOption
type Decoder ΒΆ
type Decoder struct {
// contains filtered or unexported fields
}
type Header ΒΆ
type Header struct {
Name string // Name of the final output file
Size uint64 // Final, overall file size (of all parts decoded)
Part uint64 // Part number (starts from 1)
Total uint64 // Total number of parts. Optional even for multipart.
Line uint64 // Average line length
Begin uint64 // Part begin offset (0-indexed). Note the begin keyword in the =ypart line is 1-indexed.
End uint64 // Part end offset (0-indexed, exclusive)
}
yEncode header information
Click to show internal directories.
Click to hide internal directories.