Minor Changes
-
BREAKING CHANGE: Renamed
openFile()toopenLazyFile(), removedgetFile()Since
LazyFileno longer extendsFile, the function name now explicitly reflects the return type. ThegetFile()alias has also been removed—useopenLazyFile()instead.Migration:
import { openLazyFile } from '@remix-run/fs' let lazyFile = openLazyFile('./document.pdf') // Streaming let response = new Response(lazyFile.stream()) // For non-streaming APIs that require a complete File (e.g. FormData) formData.append('file', await lazyFile.toFile())
Note:
.toFile()and.toBlob()read the entire file into memory. Only use these for non-streaming APIs that require a completeFileorBlob(e.g.FormData). Always prefer.stream()if possible.