Tiny helpers for reading, writing, appending, and streaming text files in Deno.
- 📖 Read entire text files with one line
- ✍️ Write text (with auto parent directory creation)
- ➕ Append text intelligently (adds newline if needed)
- 🌊 Stream large files line-by-line without loading into memory
- 🛡️ Full TypeScript support & JSDoc documentation
-
Deno:
deno add jsr:@dep/text
import * as text from '@dep/text';Read a text file as a string.
const content = await text.read('config.txt');
console.log(content);Write text to a file. Creates parent directories automatically.
await text.write('logs/app.log', 'Server started\n');Append text to a file. Creates the file if it doesn't exist. Adds a newline if the file doesn't end with one.
await text.append('log.txt', 'Error: Something went wrong');Stream a file line by line — perfect for large logs or CSVs.
for await (const line of text.stream('big.csv')) {
console.log(line);
}MIT License – see LICENSE for details.
Author: Estarlin R (estarlincito.com)