You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The capability-gated ctx.media given to plugins (MediaAccess / MediaAccessWithWrite) exposes no way to read media content and no streaming on either read or write. Plugins that transform media are forced to either buffer whole files in memory (OOM in the worker) or reach around the abstraction into the raw storage binding.
Current surface
MediaAccess / MediaAccessWithWrite:
get(id) → MediaItem — metadata only (size, url, …); no content
getUploadUrl() — presigned URL, explicitly noted as unusable by sandboxed plugins (which can't make external requests)
list, delete
There is no content-read method at all, and no ReadableStream path in or out.
Consequence
A sandboxed plugin (media:read / media:write) that reads a source object, transforms it, and writes a derived object must:
Bypass the abstraction to the deployment's raw storage binding to read content (which couples the plugin to the storage provider), and
Buffer the full output as an ArrayBuffer to call upload.
In a Worker (~128 MB memory ceiling), holding input + a copy + output simultaneously OOM-crashes on large files.
Notably, the underlying StorageProvider already streams both ways — download(key) → { body: ReadableStream } and upload({ body: ReadableStream }). The capability exists at the storage layer; it just isn't surfaced through the plugin-facing media API.
Proposed
Add a content read to MediaAccess — e.g. download(id): Promise<{ body: ReadableStream<Uint8Array>; size: number | null; mimeType: string }> — plumbed to the provider's existing download.
Add a streaming upload overload to MediaAccessWithWrite accepting ReadableStream<Uint8Array> alongside ArrayBuffer, plumbed to the provider's existing streaming upload.
This lets a sandboxed plugin stream source → transform → derived in O(1) memory, without touching the raw storage binding.
Trigger (abstract)
Any sandboxed media-transform plugin: for inputs larger than the worker memory ceiling it cannot complete without either bypassing ctx.media or OOMing. Reproducible with a trivial "copy/transform one media item to another" plugin, independent of content type.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Summary
The capability-gated
ctx.mediagiven to plugins (MediaAccess/MediaAccessWithWrite) exposes no way to read media content and no streaming on either read or write. Plugins that transform media are forced to either buffer whole files in memory (OOM in the worker) or reach around the abstraction into the raw storage binding.Current surface
MediaAccess/MediaAccessWithWrite:get(id) → MediaItem— metadata only (size,url, …); no contentupload(filename, contentType, bytes: ArrayBuffer)— bytes-onlygetUploadUrl()— presigned URL, explicitly noted as unusable by sandboxed plugins (which can't make external requests)list,deleteThere is no content-read method at all, and no
ReadableStreampath in or out.Consequence
A sandboxed plugin (
media:read/media:write) that reads a source object, transforms it, and writes a derived object must:ArrayBufferto callupload.In a Worker (~128 MB memory ceiling), holding input + a copy + output simultaneously OOM-crashes on large files.
Notably, the underlying
StorageProvideralready streams both ways —download(key) → { body: ReadableStream }andupload({ body: ReadableStream }). The capability exists at the storage layer; it just isn't surfaced through the plugin-facing media API.Proposed
MediaAccess— e.g.download(id): Promise<{ body: ReadableStream<Uint8Array>; size: number | null; mimeType: string }>— plumbed to the provider's existingdownload.MediaAccessWithWriteacceptingReadableStream<Uint8Array>alongsideArrayBuffer, plumbed to the provider's existing streaming upload.This lets a sandboxed plugin stream source → transform → derived in O(1) memory, without touching the raw storage binding.
Trigger (abstract)
Any sandboxed media-transform plugin: for inputs larger than the worker memory ceiling it cannot complete without either bypassing
ctx.mediaor OOMing. Reproducible with a trivial "copy/transform one media item to another" plugin, independent of content type.All reactions