0.1.6 • Published 3 years ago
@neople.dev/dotfs v0.1.6
Neople DotFS for node.js
DotFS is built for easy file system use.
Installation & import
Install
yarn add @neople.dev/dotfs
# and
npm install @neople.dev/dotfs
Import
// ES6
import DotFS from "@neople.dev/dotfs";
// Require.js
let DotFS = require("@neople.dev/dotfs");
Samples? Yeah!
Initilization
let fs = new DotFS(__dirname); // Create DotFS instance
Read file:
/* Initilization code */
let file = fs.root().$(__filename); // Get current file.
if(file.isExits) console.log(await file.read("utf-8")); // If file exits read and print to console
Write file:
/* Initilization code */
let file = fs.$(__filename); // Get current file.
await file.write(file.read("utf-8")); //Rewrite file
Append/Prepend file:
/* Initilization code */
let file = fs.$(__filename); // Get current file.
await file.append(`\n console.log("Appended!");`);
await file.prepend(`\n console.log("Appended!");`);
Run tests
Use yarn test
.