Versions in this module Expand all Collapse all v0 v0.1.0 Feb 4, 2026 Changes in this version + const MaxReplayableBodySize + var ErrFileNotFound = errors.New("file does not exist") + var ErrFileNotPrepared = errors.New("no file prepared: call PrepareFile first") + var ErrInvalidCompression = errors.New("unsupported compression type") + var ErrInvalidWriterType = errors.New("invalid writer type") + var ErrMissingFilePath = errors.New("file path must be specified when using WriteToFile") + var ErrUnexpectedFilePath = errors.New("filepath should not be provided when using WriteToBuffer") + func NewProgressReader(r io.Reader, totalSize int64, onProgress func(current, total int64)) io.Reader + func NewProgressWriter(w io.Writer, totalSize int64, onProgress func(current, total int64)) io.Writer + type CompressionConfig struct + Compressor func(w *io.PipeWriter) (io.WriteCloser, error) + CustomType CompressionType + Decompressor func(r io.Reader) (io.Reader, error) + Type CompressionType + type CompressionType string + const CompressionBrotli + const CompressionCustom + const CompressionDeflate + const CompressionGzip + const CompressionNone + type FileConfig struct + func (f *FileConfig) SetPath(path string) + func (f *FileConfig) SetSize(size int64) + type LoggingConfig struct + Enabled bool + Logger slog.Logger + type Option struct + Compression CompressionConfig + Context context.Context + Cookies []*http.Cookie + File FileConfig + Header http.Header + Logging LoggingConfig + Progress ProgressConfig + Range RangeConfig + Redirect RedirectConfig + ResponseWriter ResponseWriter + Tracing TracingConfig + Transport TransportConfig + UserAgent string + func New(opts ...*Option) *Option + func (opt *Option) AddCookie(cookie *http.Cookie) *Option + func (opt *Option) AddHeader(key string, value string) *Option + func (opt *Option) ClearCookies() *Option + func (opt *Option) ClearHeaders() *Option + func (opt *Option) ClearRange() *Option + func (opt *Option) Client() *http.Client + func (opt *Option) Clone() *Option + func (opt *Option) CreatePayloadReader(payload any) (io.Reader, int64, error) + func (opt *Option) DisableLogging() *Option + func (opt *Option) DisablePreserveMethod() *Option + func (opt *Option) DisableRedirects() *Option + func (opt *Option) EnableLogging() *Option + func (opt *Option) EnablePreserveMethod() *Option + func (opt *Option) EnableRedirects() *Option + func (opt *Option) Filename() string + func (opt *Option) GenerateIdentifier() string + func (opt *Option) HasFile() bool + func (opt *Option) HasRange() bool + func (opt *Option) IdentifierType() UniqueIdentifierType + func (opt *Option) InitialiseWriter() (io.WriteCloser, error) + func (opt *Option) Log(msg string, args ...any) + func (opt *Option) MaxRedirects() int + func (opt *Option) Merge(src *Option) *Option + func (opt *Option) NewCompressor(w *io.PipeWriter) (io.WriteCloser, error) + func (opt *Option) NewDecompressor(r io.ReadCloser, encoding string) (io.ReadCloser, error) + func (opt *Option) OnDownloadProgress(fn func(bytesRead, totalBytes int64)) *Option + func (opt *Option) OnUploadProgress(fn func(bytesRead, totalBytes int64)) *Option + func (opt *Option) OpenFile() (*os.File, error) + func (opt *Option) PrepareFile(filename string) error + func (opt *Option) ProgressTracking() ProgressTracking + func (opt *Option) Redirects(enabled bool, preserve bool, max int) *Option + func (opt *Option) Resume(filepath string) *Option + func (opt *Option) SetBufferOutput() *Option + func (opt *Option) SetClient(client *http.Client) *Option + func (opt *Option) SetCompression(compressionType CompressionType) *Option + func (opt *Option) SetContext(ctx context.Context) *Option + func (opt *Option) SetDownloadBufferSize(size int) *Option + func (opt *Option) SetFileOutput(filepath string) *Option + func (opt *Option) SetIdentifierType(t UniqueIdentifierType) *Option + func (opt *Option) SetLogger(logger *slog.Logger) *Option + func (opt *Option) SetMaxRedirects(max int) *Option + func (opt *Option) SetMaxResponseHeaderBytes(size int64) *Option + func (opt *Option) SetOutput(writerType ResponseWriterType, filepath ...string) error + func (opt *Option) SetProtocol(p Protocol) *Option + func (opt *Option) SetProtocolScheme(scheme string) *Option + func (opt *Option) SetRange(start, end int64) *Option + func (opt *Option) SetRangeFrom(offset int64) *Option + func (opt *Option) SetRangeLast(n int64) *Option + func (opt *Option) SetTransport(transport *http.Transport) *Option + func (opt *Option) SetUploadBufferSize(size int) *Option + func (opt *Option) Size() int64 + func (opt *Option) TrackAfterCompression() *Option + func (opt *Option) TrackBeforeCompression() *Option + func (opt *Option) UseJsonLogger() *Option + func (opt *Option) UsePerRequestClient() *Option + func (opt *Option) UseSharedClient() *Option + func (opt *Option) UseTextLogger() *Option + func (opt *Option) Writer() io.WriteCloser + type ProgressConfig struct + DownloadBufferSize *int + OnDownload func(bytesRead, totalBytes int64) + OnUpload func(bytesRead, totalBytes int64) + Tracking ProgressTracking + UploadBufferSize *int + type ProgressTracking int + const TrackAfterCompression + const TrackBeforeCompression + type Protocol int + const Both + const HTTP1 + const HTTP2 + const UnencryptedHTTP2 + type RangeConfig struct + End int64 + IsResume bool + IsSet bool + Last int64 + Start int64 + func (rc *RangeConfig) RangeHeader() string + type RedirectConfig struct + Follow bool + Max int + PreserveMethod bool + type ResponseWriter struct + FilePath string + Type ResponseWriterType + type ResponseWriterType string + const WriteToBuffer + const WriteToFile + type TracingConfig struct + Type UniqueIdentifierType + type TransportConfig struct + HTTP *http.Transport + MaxResponseHeaderBytes int64 + Protocol Protocol + Scheme string + type UniqueIdentifierType string + const IdentifierNone + const IdentifierRGS + const IdentifierULID + const IdentifierUUID + type WriteCloserBuffer struct + func (w *WriteCloserBuffer) IsEmpty() bool + func (wcb *WriteCloserBuffer) Close() error