Use this file to discover all available pages before exploring further.
Lazy, streaming filesystem utilities for JavaScript. This package provides utilities for working with files on the local filesystem using the LazyFile/native File API.
import { openLazyFile } from 'remix/fs'// Open a file from the filesystemlet lazyFile = openLazyFile('./path/to/file.json')// The file is lazy - no data is read until you access itlet json = JSON.parse(await lazyFile.text())console.log(json)// Read as byteslet bytes = await lazyFile.bytes()// Get a readable streamlet stream = lazyFile.stream()
import { openLazyFile, writeFile } from 'remix/fs'// Read a file and write it elsewherelet lazyFile = openLazyFile('./source.txt')await writeFile('./destination.txt', lazyFile)
import { openLazyFile, writeFile } from 'remix/fs'import * as fsp from 'node:fs/promises'// Open a file handlelet handle = await fsp.open('./destination.txt', 'w')// Write to the handlelet lazyFile = openLazyFile('./source.txt')await writeFile(handle, lazyFile)// Close the handleawait handle.close()
import { openLazyFile } from 'remix/fs'let lazyFile = openLazyFile('./large-file.json')let stream = lazyFile.stream()// Process the streamfor await (let chunk of stream) { // Process each chunk console.log('Chunk size:', chunk.byteLength)}