Documentation
¶
Index ¶
- func Download(ctx context.Context, p Path) ([]byte, error)
- func DownloadStream(ctx context.Context, p Path) (io.ReadCloser, error)
- func ListFiles(ctx context.Context, p Path) ([]string, error)
- func ResolveDirectURL(ctx context.Context, p Path) (directURL string, size int64, err error)
- func SetHTTPClient(c *http.Client)
- type HTTPStatusError
- type Path
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadStream ¶ added in v0.1.8
func ResolveDirectURL ¶ added in v0.1.25
ResolveDirectURL resolves the final, redirect-followed download URL for a Hugging Face file along with its size in bytes. The returned URL is a public (typically signed CDN) URL suitable for server-side copy by another service (e.g. Azure Blob's copy-from-URL). Size is -1 when unknown.
func SetHTTPClient ¶ added in v0.1.21
SetHTTPClient installs a process-wide HTTP client used for all requests issued by this package. Passing nil clears the override and restores http.DefaultClient behavior.
This must be called before any request is issued, e.g. from main's Before: hook, so that all callers observe the override.
Types ¶
type HTTPStatusError ¶ added in v0.1.17
HTTPStatusError is returned when an HTTP request returns a non-2xx status code.
func (*HTTPStatusError) Error ¶ added in v0.1.17
func (e *HTTPStatusError) Error() string