Modules@robinpath/fs

@robinpath/fs

0.1.0Public

Read, write, copy, move, and manage files and directories

@robinpath/fs

Read, write, copy, move, and manage files and directories

Category Functions Auth License

Why use this module?

The fs module lets you:

  • Read the contents of a file as a string
  • Write content to a file, creating or overwriting it
  • Append content to the end of a file
  • Check whether a file or directory exists at the given path
  • Delete a file

All functions are callable directly from RobinPath scripts with a simple, consistent API.

Installation

npm install @robinpath/fs

Quick Start

No credentials needed — start using it right away:

any "/tmp/file.txt" "hello world"

Available Functions

FunctionDescription
fs.readRead the contents of a file as a string
fs.writeWrite content to a file, creating or overwriting it
fs.appendAppend content to the end of a file
fs.existsCheck whether a file or directory exists at the given path
fs.deleteDelete a file
fs.copyCopy a file from source to destination
fs.moveMove or rename a file from source to destination
fs.renameRename a file (alias for move)
fs.listList the contents of a directory
fs.mkdirCreate a directory (recursively creates parent directories)
fs.rmdirRemove a directory and its contents
fs.statGet file or directory statistics
fs.isFileCheck whether a path points to a regular file
fs.isDirCheck whether a path points to a directory

Examples

Write content to a file, creating or overwriting it

any "/tmp/file.txt" "hello world"

Append content to the end of a file

any "/tmp/file.txt" "more text"

Check whether a file or directory exists at the given path

any "/tmp/file.txt"

Integration with RobinPath

import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/fs";

const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);

const result = await rp.executeScript(`
  any "/tmp/file.txt" "hello world"
`);

Full API Reference

See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.

Related Modules

License

MIT

Versions (1)

VersionTagPublished
0.1.0latestyesterday
Install
$ robinpath install @robinpath/fs
Version0.1.0
LicenseMIT
Unpacked Size5.9 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

Category

utilities