Documentation
¶
Index ¶
- func AcquireBuffer() *bytes.Buffer
- func BytesReader(b []byte) *bytes.Reader
- func CloneBytes(b []byte) []byte
- func DetectFormat(data []byte) string
- func DrainReader(ctx context.Context, r io.Reader, chunkSize int) (*bytes.Buffer, error)
- func PeekReader(orig []byte, n int) (peek []byte, rest []byte)
- func ReleaseBuffer(b *bytes.Buffer)
- func ScaleDimensions(srcW, srcH, targetW, targetH int) (int, int)
- type ChunkedWriter
- type LimitedReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcquireBuffer ¶
AcquireBuffer returns a reset buffer from the pool.
func BytesReader ¶
BytesReader creates an io.Reader backed by b without allocation.
func CloneBytes ¶
CloneBytes returns a copy of b (safe for use after the source buffer is released).
func DetectFormat ¶
DetectFormat sniffs the first 512 bytes of data and returns the image format.
func DrainReader ¶
DrainReader reads all bytes from r into a pooled buffer and returns them. The caller owns the returned slice; pass the buffer back with ReleaseBuffer.
func PeekReader ¶
PeekReader reads up to n bytes without consuming them (returns a new reader containing the peeked bytes followed by the rest of orig).
func ReleaseBuffer ¶
ReleaseBuffer returns b to the pool. Callers must not use b after this call.
func ScaleDimensions ¶
ScaleDimensions computes output (w, h) preserving aspect ratio. Pass 0 for either axis to calculate it from the other.
Types ¶
type ChunkedWriter ¶
ChunkedWriter splits writes into fixed-size chunks; useful for streaming uploads.