1.0.4 • Published 3 years ago
nicefs v1.0.4
nicefs is a Node library whose goal is to provide a
clean path & filesystem API. It's designed after Go's
filepath
and os
packages.
yarn add nicefs
And to use, just import FS
and Path
:
import {FS, Path} from "nicefs"
async function main() {
Path.extension(fname) // Returns: ".jpg"
// Splits path into dir & file:
let {dir, file} = Path.splitDirFile("/home/user/readme.txt")
// Returns "/home/user"
let home = Path.homeDir();
await FS.removeAll("/my/dir") // Deletes /my/dir
await FS.readDir("/my/dir") // Returns: ["a.txt", "b.txt"]
// reading as binary and utf8
await FS.readFile("my.file")
await FS.readFile("my.file2", "utf8")
}
💡 API & examples
Available at https://fikisipi.github.io/nicefs/
Features
- TypeScript and TypeDoc documentation available
- Supports both esm and commonjs bundling