Skip to content

aneldev/dyna-node-fs

Repository files navigation

About

Basic node.js file actions that return Promises.

No dependencies, can fit easy with universal projects.

Written in Typescript, runs everywhere.

Methods

loadJSON(filename: string): Promise

Loads a file.

Resolves with a object saved in the JSON file.

saveJSON(filename: string, data: any, humanReadable: boolean = false): Promise

Saves a file with an object is JSON format.

exists(filename: string): Promise

Resolves with boolean is the file exists or not.

deleteFile(filename: string): Promise

more commands later

mkdir(path: string): Promise

Create a directories recursively.

rmdir(path: string): Promise

Deletes a directory with all contents of it.

isFolderEmpty(path: string): Promise

Returns true if the folder contains files or sub folders.