Skip to content

dep-ts/text

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@dep/text 📝

Tiny helpers for reading, writing, appending, and streaming text files in Deno.

JSR version

Features ✨

  • 📖 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

Installation 📦

  • Deno:

    deno add jsr:@dep/text

Usage 🎯

API 🧩

import * as text from '@dep/text';

text.read(path, options?)

Read a text file as a string.

const content = await text.read('config.txt');
console.log(content);

text.write(path, data, options?)

Write text to a file. Creates parent directories automatically.

await text.write('logs/app.log', 'Server started\n');

text.append(path, data, options?)

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');

text.stream(path, options?)

Stream a file line by line — perfect for large logs or CSVs.

for await (const line of text.stream('big.csv')) {
  console.log(line);
}

License 📄

MIT License – see LICENSE for details.

Author: Estarlin R (estarlincito.com)

About

Tiny helpers for reading, writing, appending, and streaming text files in Deno.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published