Skip to content

feat(client): add getHiddenFileSignedUrl for ranged streaming#22

Open
agviegas wants to merge 1 commit into
mainfrom
feat/hidden-file-signed-url
Open

feat(client): add getHiddenFileSignedUrl for ranged streaming#22
agviegas wants to merge 1 commit into
mainfrom
feat/hidden-file-signed-url

Conversation

@agviegas

Copy link
Copy Markdown
Contributor

What

Adds EngineServicesClient.getHiddenFileSignedUrl(hiddenId, expiresIn?).

const { url, expiresAt } = await client.getHiddenFileSignedUrl(hiddenId);
// fetch ranges directly:
const res = await fetch(url, { headers: { Range: "bytes=0-65535" } }); // 206

Why

downloadHiddenFile() streams the whole object. For very large hidden files — e.g. a point cloud's octree.bin that a viewer reads in small [offset, length] slices — downloading the entire file isn't viable. This method returns a short-lived signed URL the browser can fetch directly with native HTTP Range requests, so the renderer pulls only the bytes it needs.

Notes

  • Returns { url, expiresAt }. expiresAt is an ISO timestamp; re-call to refresh the URL when it nears/passes expiry. Optional expiresIn (seconds) requests a specific lifetime.
  • Read-only; complements the existing downloadHiddenFile() (still the right call for whole small files).

Testing

  • tsc --noEmit green.

Adds EngineServicesClient.getHiddenFileSignedUrl(hiddenId, expiresIn?), which
returns a short-lived signed URL ({ url, expiresAt }) for a hidden file. This
lets the browser fetch large hidden files directly with native HTTP Range
requests (e.g. streaming a point cloud's octree.bin) instead of downloading
the whole object. Re-call to refresh the URL when it nears expiry.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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