Skip to content

feat: add ImageBytes API for in-memory image download#7

Merged
spiegel-im-spiegel merged 1 commit into
mainfrom
copilot/add-imagebytes-method
May 12, 2026
Merged

feat: add ImageBytes API for in-memory image download#7
spiegel-im-spiegel merged 1 commit into
mainfrom
copilot/add-imagebytes-method

Conversation

@spiegel-im-spiegel

Copy link
Copy Markdown
Member

Summary

Add a new (*Webinfo).ImageBytes(ctx) API to download image content into memory.

Changes

  • Add ImageBytes(ctx) method to webinfo.go
    • validates nil receiver and empty ImageURL
    • fetches image with configured User-Agent
    • returns response body as []byte
    • wraps errors with context and joins close errors
  • Add tests in webinfo_test.go
    • nil receiver case
    • empty URL case
    • success case with httptest server
  • Update README.md
    • usage example for ImageBytes
    • Public API list
    • behavior note about memory risk for large images

Validation

  • task test

@spiegel-im-spiegel spiegel-im-spiegel merged commit 1ff19a4 into main May 12, 2026
4 checks passed
@spiegel-im-spiegel spiegel-im-spiegel deleted the copilot/add-imagebytes-method branch May 12, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant