Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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 mkdir(dirpath);
读取文件夹内容
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 = 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
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.