Object identifier appended directly to host. It must produce a
URL whose path is exactly /${id} and which has no credentials, query, or
fragment.
HTTPS origin prefix ending in /, for example
https://objects.example/.
Cache freshness in milliseconds, expressed through
standard Cache-Control, Date, and Expires response headers.
Raw AES-GCM key bytes used to encrypt the object. The key must be valid for the Web Crypto API (16, 24, or 32 bytes).
Any value supported by the MessagePack encoder.
Called once with the compressed, encrypted, and MessagePack-wrapped bytes after they have been cached. The callback owns remote persistence, and its return value is not awaited.
A promise that settles after local caching and callback invocation. It does not imply that callback-managed remote persistence has completed.
void storeObject(
'welcome',
'https://objects.example/',
15 * 60 * 1000,
key,
{ title: 'Hello' },
(bytes) => {
void fetch('/api/objects/welcome', {
method: 'PUT',
headers: { 'content-type': 'application/octet-stream' },
body: bytes,
})
}
)
Encrypts an object and stores its encoded representation in the Cache API.
This function provides local caching, not durable remote persistence. After encoding, compression, encryption, and caching succeed,
onObjectStoredis called with the opaque bytes that the application can upload to its storage service. Persist the bytes unchanged athost + idwith theapplication/octet-streammedia type so that loadObject can retrieve them later. The public read endpoint must support cross-origin access for its intended consumers, typically withAccess-Control-Allow-Origin: *.The callback's return value is ignored and is not awaited. If the caller must observe remote persistence, it should track and await that work separately. Encoding, encryption, cache, and callback failures reject the returned promise; failures in an unobserved promise created by the callback do not.