
Security News
PyPI Expands Trusted Publishing to GitLab Self-Managed as Adoption Passes 25 Percent
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads
exports all fs.promises + exists + mkdirp + rmrf functions.
be in a nodejs project
npm install @magic/fs
import fs from '@magic/fs'
const run = async () => {
await fs.mkdirp('./test_235235/dir/to/create')
console.log('dir created')
await fs.rmrf('./test_235235')
console.log('dir deleted, even though it had contents.')
}
run()
promises from fs:
access
copyFile
open
opendir
rename
truncate
rmdir
mkdir
readdir
readlink
symlink
lstat
stat
link
unlink
chmod
lchmod
lchown
chown
utimes
realpath
mkdtemp
writeFile
appendFile
readFile
exists
readDir
readfile
rmDir
rmdir, rmDir
readfile, readFile
readdir, readDir
same as mkdir -p on unix
await fs.mkdirp('./path/to/dir')
same as rm -rf on unix.
will not work outside process.cwd()
await fs.rmrf('./path/to/dir')
same as fs.exists, but promisified and ready for esmodules.
get a list of directories in a directory, recursively.
import fs from '@magic/fs'
const run = async () => {
// first level directories
const directories = await fs.getDirectories(process.cwd())
console.log(directories)
// recursive run
const deepDirectories = await fs.getDirectories(process.cwd(), true)
console.log(deepDirectories)
}
run()
get a list of files in a directory, recursively.
import fs from '@magic/fs'
const run = async () => {
// first level directories
const files = await fs.getFiles(process.cwd())
console.log(files)
// recursive run
const deepFiles = await fs.getFiles(process.cwd(), true)
console.log(deepFiles)
}
run()
get the file type of a file, based on extension, and defaulting to "txt"
import fs from '@magic/fs'
const fileType = fs.getFileType('html.html')
console.log(fileType, fileType === 'html')
const nonFileType = fs.getFileType()
console.log(nonFileType, nonFileType === 'txt')
first publish
FAQs
nodejs fs promises + goodies
We found that @magic/fs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.