https://github.com/aallali/sysify
A Lightweight, TypeScript-Powered File System Wrapper for Node.js
https://github.com/aallali/sysify
filesystem fs nodejs scripting typescript
Last synced: 3 months ago
JSON representation
A Lightweight, TypeScript-Powered File System Wrapper for Node.js
- Host: GitHub
- URL: https://github.com/aallali/sysify
- Owner: aallali
- License: mit
- Created: 2025-01-07T20:00:13.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2025-01-13T20:20:22.000Z (12 months ago)
- Last Synced: 2025-01-13T20:20:39.343Z (12 months ago)
- Topics: filesystem, fs, nodejs, scripting, typescript
- Language: TypeScript
- Homepage: https://github.com/aallali/Sysify#readme
- Size: 121 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sysify
**β¨ A Lightweight, TypeScript-Powered File System Wrapper for Node.js β¨**
[](https://www.typescriptlang.org/)
[](https://nodejs.org/)
[](https://opensource.org/licenses/MIT)
[](https://www.npmjs.com/package/sysify)
[](https://github.com/aallali/sysify/issues)
[](https://github.com/aallali/sysify/stargazers)
[](https://github.com/aallali/sysify/network/members)
[](https://codecov.io/github/aallali/Sysify)
**`Sysify`** is a lightweight yet powerful wrapper for the Node.js filesystem module, providing an intuitive and typed API for essential terminal-like commands. Itβs designed to enable developers to write scripts for managing files and directories quickly and efficiently.
With `Sysify`, you can leverage commands like `mkdir`, `cd`, `ls`, `touch`, `rm`, and more in a way that feels natural to developers familiar with terminal commands.
---
## β¨ Features
- **π Essential Terminal Commands**: Execute familiar file system operations programmatically (βe.g., mkdir, ls, rmβ).
- **π Typed and Extensible API**: Built with TypeScript for type safety and scalability.
- **π§ Script-Friendly**: Simplify writing automation scripts and utilities.
- **π Metadata Tracking**: Access file and directory metadata like size and permissions.
- **π° Lightweight and Fast**: Optimized for minimal overhead while retaining robust functionality.
---
## π₯ Installation
Install `sysify` via _`pnpm`_:
```bash
pnpm install sysify
```
---
## π Quick Start
Hereβs a quick example of how to get started with `Sysify`:
```typescript
import { FileSystem } from 'sysify';
const fs = new FileSystem();
// Create a new directory
fs.mkdir('projects');
// Navigate into the directory
fs.cd('projects');
// Create a new file with content
fs.touch('readme.txt', 'Welcome to Sysify!');
// List contents of the current directory
console.log(fs.ls()); // Output: ['readme.txt']
// Delete the file
fs.delete('readme.txt');
// Go back to the root directory
fs.cd('..');
// Delete "projects" folder (a.k.a 'rm -rf projects/')
fs.delete('projects')
```
---
## π§ Supported Commands
### File and Directory Management
- **`mkdir(directory: string, options: { silent: boolean } = {})`**: Create a new directory.
- **`cd(directory: string)`**: Change the current working directory.
- **`ls()`**: List contents of the current directory.
- **`touch(file: string, content?: string | Buffer)`**: Create a new file.
- **`delete(target: string, options: { recursive?: boolean, silent: boolean, force?: boolean } = {})`**: Remove a file or directory.
- **`copy(source: string, destination: string, options: { recursive?: boolean, force?: boolean, overwrite?: boolean, silent?: boolean } = {})`**: Copy files or directories.
- **`move(source: string, destination: string, options: { force?: boolean, overwrite?: boolean, silent?: boolean } = {})`**: Move files or directories.
- **`rename(oldPath: string, newPath: string)`**: Rename a file or directory.
- **`readFile(filePath: string, options?: { encoding?: BufferEncoding, flag?: string })`**: Read file content as string or Buffer.
### Metadata
- **`pwd()`**: Get the current working directory.
---
## β‘ Why Sysify?
- **Ease of Use**: Intuitive API that mirrors terminal commands.
- **Type Safety**: Reduce errors and improve code clarity with TypeScript.
- **Customization**: Easily extend functionality to meet your specific needs.