@betechspark/imageproxy-client
v0.1.2
Published
TypeScript helpers for betechspark Image Proxy — URL builders, transforms, and source-key encoding.
Downloads
261
Maintainers
Readme
@betechspark/imageproxy-client
Framework-agnostic TypeScript helpers for the betechspark Image Proxy — build GET /image/:id and GET /asset/:encoded URLs with transforms and optional File Server HMAC query params.
Install
npm i @betechspark/imageproxy-clientQuick start
import {
buildImageByUuid,
buildAssetByFileserverId,
buildAssetByUrl,
encodeSourceKey,
} from '@betechspark/imageproxy-client';
const base = 'https://images.example.com';
// Catalog UUID
const thumb = buildImageByUuid(base, fileId, { w: 400, f: 'webp', q: 82 });
// File Server record via /asset
const asset = buildAssetByFileserverId(base, fileId, { w: 800, fit: 'cover' });
// Remote URL source
const remote = buildAssetByUrl(base, 'https://cdn.example/photo.jpg', { w: 600 });Routes
| Function | HTTP route |
| -------- | ---------- |
| buildImageByUuid | GET /image/:id |
| buildAssetBySourceKey | GET /asset/:base64url(sourceKey) |
| buildAssetByFileserverId | source key fileserver/<uuid> |
| buildAssetByUrl | source key url/<encoded-url> |
| buildAssetByFsPath | source key fs/<alias>/<path> |
| buildAssetByContentHash | blob path under fs/data/objects/... (prefix configurable) |
Private assets
For fileserver/<id> on /asset, append exp and sig from your server (@betechspark/imageproxy-server). For private catalog rows on /image/:id, use a JWT bearer (@betechspark/imageproxy-server signImageJwt).
Related packages
@betechspark/imageproxy-server— JWT + File Server HMAC for asset URLs@betechspark/imageproxy-react— React hooks and Next.jsnext/imageloader
See USAGE.md for a step-by-step guide.
