Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
nodejs 下文件相关封装
npm i qiao-file
// cjs
const { isExists } = require('qiao-file');
// mjs
import { isExists } from 'qiao-file';
复制文件或文件夹
const res = await cp(src, dest);
const res = await mv(src, dest);
删除文件或文件夹
const res = await rm(path);
读取文件夹内容
const res = await readDir(dirpath);
列出文件夹下所有的文件和文件夹路径
const res = await lsdir(dirpath);
列出文件夹下所有的文件和文件夹信息,以树的方式
const dirpath = 'xx';
const ignores = ['node_modules', 'is-'];
const res = await lstree(dirpath, ignores);
创建文件夹
const res = await mkdir(dirpath);
获取文件的后缀
const res = extname(filePath);
读取文件内容
const res = await readFile(filePath);
按行读取文件
readFileLineByLine(filePath, onLine, onClose);
写文件
const res = await writeFile(filePath, 'sth');
判断文件路径是否为文件夹
const res = await isDir(fpath);
判断文件或者文件夹是否存在
const res = await isExists(fpath);
FAQs
nodejs file tool
The npm package qiao-file receives a total of 58 weekly downloads. As such, qiao-file popularity was classified as not popular.
We found that qiao-file demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.