The usual large-media trap
A naive encrypted chunk store has an ugly read path: rebuild the full file into memory or a temporary object, then let the browser or preview tool seek inside that rebuilt copy. That wastes RAM, disk, time, and operator patience.
- Video preview should not require full-file reassembly.
- A paused download should not need the server to read from byte zero again.
- Object storage should not force a separate whole-file cache for ordinary range reads.
Logical stream over chunks
Cotton assembles a single seekable stream from multiple chunk streams. Seek locates the target chunk by cumulative offsets and switches the underlying chunk stream so reads continue from the correct physical piece.
Range responses
The same stream shape can serve HTTP Range requests and partial downloads. The product result is simple: large files can be read in pieces instead of becoming a full-object transfer every time.
Preview extraction
Video preview generation can point FFmpeg at a range-capable local stream bridge. FFmpeg can ask for metadata and frames through byte ranges without Cotton writing a complete temporary source file first.
Compression and encryption make it hard
Seeking is not just concatenating plain files. Cotton still has to preserve per-chunk AES-GCM authentication, nonce discipline, compression ordering, chunk boundaries, and concurrent range reads without trusting unauthenticated bytes.
S3-backed storage implication
Because the abstraction is chunk streams rather than a single local file path, the same logical model can work when chunks live behind filesystem storage or S3-compatible object storage. The backend changes, but the read contract stays stable.
Seek path proof
The proof is a concrete read shape: manifest offsets identify chunks, the logical stream seeks to the right chunk, processors read back through the backend, crypto, and decompression stages, and callers receive a normal stream or HTTP Range response.
Media stays usable
This is one of the differences between a storage engine and a real file cloud. The file can be large, encrypted, chunked, previewable, shareable, and still readable by slice.
Not a universal codec promise
Seekable chunk reads make partial access possible. Browser codec support, FFmpeg availability, file corruption, client behavior, and deployment performance still decide what a specific media file can preview or play.