Summary
All known real-world implementations of the COS API call requestFileHandles() with exactly one hash and read back exactly one handle. The plural form is never used as intended. This issue proposes renaming the method to requestFileHandle() (singular) to better match actual usage.
Evidence
A broad code search across GitHub (31 total results) was conducted across all known independent implementations. Every single call site passes a single-element array and reads back a single handle:
| Repo |
Pattern used |
huggingface/transformers.js |
const [handle] = await ...requestFileHandles([hash]) |
ngxson/wllama |
const [handle] = await ...requestFileHandles([hash]) |
flutter/flutter |
const [handle] = await ...requestFileHandles([hash]) |
apache/tvm |
const handles = await ...requestFileHandles([hash]); const handle = handles[0] |
mlc-ai/relax |
const handles = await ...requestFileHandles([hash]); const handle = handles[0] |
GoogleChromeLabs/web-ai-demos |
const [handle] = await ...requestFileHandles([hash]) |
Emscripten (tomayac/emscripten PR #27066) |
requestFileHandles([cosHash]) |
Zero implementations pass more than one hash in a single call.
Problems with the current plural form
- Misleading ergonomics. Every consumer is forced to write
const [handle] = await ...requestFileHandles([singleHash]) — wrapping a single item in an array only to destructure it back out is pure boilerplate noise.
- False promise of batching. The plural signature implies atomicity or efficiency gains from batching multiple hashes, but no implementer found this useful. AI model files are large and handled one at a time.
- Explicit workarounds. The TVM family explicitly does
const handles = ...; const handle = handles[0] — actively fighting the plural shape.
- Precedent. Web APIs conventionally reflect actual usage. If batching is ever needed in the future, a separate method or overload can be introduced.
Proposal
Rename the method:
// Before
Promise<sequence<FileSystemFileHandle>> requestFileHandles(
sequence<HashDescriptor> hashes,
optional CrossOriginStorageOptions options = {}
);
// After
Promise<FileSystemFileHandle> requestFileHandle(
HashDescriptor hash,
optional CrossOriginStorageOptions options = {}
);
Callers wanting multiple handles in parallel can use Promise.all(), which is idiomatic JS and gives better per-file error granularity.
References
huggingface/transformers.js PR #1549
ngxson/wllama PR #248
flutter/flutter PR #184149
mlc-ai/web-llm PR #748
apache/tvm web/src/artifact_cache.ts
emscripten-core/emscripten PR #27066
Summary
All known real-world implementations of the COS API call
requestFileHandles()with exactly one hash and read back exactly one handle. The plural form is never used as intended. This issue proposes renaming the method torequestFileHandle()(singular) to better match actual usage.Evidence
A broad code search across GitHub (31 total results) was conducted across all known independent implementations. Every single call site passes a single-element array and reads back a single handle:
huggingface/transformers.jsconst [handle] = await ...requestFileHandles([hash])ngxson/wllamaconst [handle] = await ...requestFileHandles([hash])flutter/flutterconst [handle] = await ...requestFileHandles([hash])apache/tvmconst handles = await ...requestFileHandles([hash]); const handle = handles[0]mlc-ai/relaxconst handles = await ...requestFileHandles([hash]); const handle = handles[0]GoogleChromeLabs/web-ai-demosconst [handle] = await ...requestFileHandles([hash])tomayac/emscriptenPR #27066)requestFileHandles([cosHash])Zero implementations pass more than one hash in a single call.
Problems with the current plural form
const [handle] = await ...requestFileHandles([singleHash])— wrapping a single item in an array only to destructure it back out is pure boilerplate noise.const handles = ...; const handle = handles[0]— actively fighting the plural shape.Proposal
Rename the method:
Callers wanting multiple handles in parallel can use
Promise.all(), which is idiomatic JS and gives better per-file error granularity.References
huggingface/transformers.jsPR #1549ngxson/wllamaPR #248flutter/flutterPR #184149mlc-ai/web-llmPR #748apache/tvmweb/src/artifact_cache.tsemscripten-core/emscriptenPR #27066