
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
file-manager-js
Advanced tools
manage files and directories on the local storage through an enhanced promise interface
It uses node filesystem to manage files and directories on the local storage through an enhanced promise interface. It can list/create/remove files and directories recursively with promises.
npm install file-manager-js
// require all functions
const fileManager = require('file-manager-js');
// OR specific functions
const { list, removeFile, rename } = require('file-manager-js');
.stat(path)
promisified fs.stat. retrieves the stats of a file or directory. https://nodejs.org/api/fs.html#fs_class_fs_stats
fileManager.stat('./test.txt')
.then((stats) => // stats)
.catch((error) => // error);
.info(path)
returns an extended stats object that includes size (bytes) and type of the path
// file info
fileManager.info('./test.txt').then((info) => {
/*
{
size: 19,
type: 'file',
...
}
*/
}).catch((error) => // error);
// directory info
fileManager.info('./test')
.then((info) => {
/*
{
size: 2146, // size of all files in dir tree
type: 'directory',
...
}
*/
})
.catch((error) => // error);
.join(path1, path2)
join two paths. a delegate to require('path').join
let p = fileManager.join('a/b/c', 'd/e/f'); // a/b/c/d/e/f
.list(path)
list first-level files and directories inside a directory
// path can be an absolute path using __dirname
fileManager.list('./project')
.then((entries) => {
/*
{
files: ['index.js', 'README.md'],
dirs : ['lib', 'node_modules', 'test']
}
*/
})
.catch((error) => // error)
.listDeep(path)
list in-depth files and directories inside a directory
fileManager.listDeep('./content')
.then((entries) => {
/*
{
files: ['test.txt', 'abc/test.csv', 'new/content/test/a.txt'],
dirs : ['abc', 'abc/test', 'new/content/test']
}
*/
})
.catch((error) => // error)
.exists(path)
checks if a path (file or directory) exists and resolve with true or false
fileManager.exists('./content')
.then((exists) => // true)
.catch((error) => // error)
fileManager.exists('./newContent')
.then((exists) => // false)
.catch((error) => // error)
.createDir(path)
creates a single directory or a directory tree
// create a directory tree
fileManager.createDir('./a/b/c/d')
.then((path) => // path = ./a/b/c/d)
.catch((error) => // error)
.createFile(path)
creates a file and creates the directory tree in the path if not exists
// creates a directory structure then the file
fileManager.createFile('./x/y/z/test.txt')
.then((path) => // path = ./x/y/z/test.txt)
.catch((error) => // error)
.readFile(path)
reads entire file content
fileManager.readFile('./x/y/z/test.txt')
.then((content) => // content is instance of Buffer)
.catch((error) => // error)
.removeDir(path)
removes a directory or directory tree with all its content
// remvove a/b/c/d + a/b/c + a/b/test.txt + a/b + a
fileManager.removeDir('./a')
.then((path) => // ./a)
.catch((error) => // error)
.removeFile(path)
removes a file
// removed ./test.txt
fileManager.removeFile('./test.txt')
.then((path) => // ./test.txt)
.catch((error) => // error)
.rename(oldPath, newPath)
rename a file or directory
// rename file ./test.txt to ./ttt.txt
fileManager.rename('./test.txt', './ttt.txt')
.then((newPath) => // ./ttt.txt)
.catch((error) => // error)
grunt build
The MIT License. Full License is here
FAQs
manage files and directories on the local storage through an enhanced promise interface
The npm package file-manager-js receives a total of 20 weekly downloads. As such, file-manager-js popularity was classified as not popular.
We found that file-manager-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.