# Streaming With large files, a naive `readFile` / `writeFile` can mean pulling the whole thing into memory. Streaming avoids that: read media back as a disk-backed `Blob` the browser can play without copying every byte first, and write from a `File`, `Blob`, or network body in chunks. | Goal | Method | | -------------------------------------------------- | ----------------------------------------- | | Play or download without buffering | `fs.readBlob(path)` | | One large upload (`File`, `Blob`, or network body) | `fs.importStream(path, source, options?)` | | Many files / a folder | `fs.importFiles(entries, options?)` | For picking files from disk (input, File System Access, paste, drag-and-drop), see [Uploading from disk](./uploading.md). For saving files out of OPFS, see [Downloading to disk](./downloading.md). ## Reading without buffering: `readBlob` `readFile` copies the whole file into memory. For video, audio, or anything you’d hand the browser as a `Blob`, use `readBlob` instead. It returns the disk-backed blob OPFS already has — nothing is read until something actually asks for bytes: ```typescript import { createOPFS } from 'opfs-worker'; const fs = createOPFS({ root: '/my-app' }); const blob = await fs.readBlob('/media/clip.mp4'); const url = URL.createObjectURL(blob); video.src = url; // later: URL.revokeObjectURL(url); ``` The browser then seeks and buffers only the ranges it plays, so a multi-gigabyte file costs no memory up front. The same `Blob` works for ``, `