
Research
Security News
Malicious npm Packages Use Telegram to Exfiltrate BullX Credentials
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
file and directory op libs, find, findSync, mkdir, mkdirSync, copy, copySync, remove, removeSync, writeFile, writeFileSync
Useful file utitiles. See API Documentation for detailed info.
Recurcively scan files or scan files by a filter.
Callback break tow arguments: err, list
var fsPath = require('fs-path');
fsPath.find('/usr/local', function(err, list){
console.log(list.dirs);
console.log(list.files);
});
The value list is an object has two keys:
{
dirs: [
'/usr/local/test'
'/usr/local/test/abc'
],
files: [
'/usr/local/aaa.png',
'/usr/local/test/bbb.gif',
'/usr/local/test/abc/ddd.html'
]
}
If you set a filter to map the files or directories, you can do like this:
var fsPath = require('fs-path');
fsPath.find('/usr/local', function(filepath, stats, filename){
if(stats === 'file' && /\.png$/.test(filename)){
return false;
}
return true;
}, function(err, list){
console.log(list.dirs);
console.log(list.files);
});
filter has 3 arguments:
It will return the list:
{
dirs: [
'/usr/local/test'
'/usr/local/test/abc'
],
files: [
'/usr/local/test/bbb.gif',
'/usr/local/test/abc/ddd.html'
]
}
Sync version of find(). Throws exception on error.
Recursively make, if the parent path not exists, it'll create the directory automatically.
var fsPath = require('fs-path');
fsPath.mkdir('/usr/local/test1/test2/test3', function(err){
console.log('ok');
});
Sync version of mkdir(). Throws exception on error.
Copy a file or directory to other path, if the parent path not exists, it'll create the directory automatically.
var fsPath = require('fs-path');
fsPath.copy('/usr/local/test1/test2/test3', '/usr/local/aaaa', function(err){
console.log('ok');
});
Sync version of copy(). Throws exception on error.
Delete a file or directory.
var fsPath = require('fs-path');
fsPath.remove('/usr/local/test1/test2/test3', function(err){
console.log('ok');
});
Sync version of remove(). Throws exception on error.
Write a file a file or directory.
Encoding is optional, default is 'utf-8'.
var fsPath = require('fs-path');
fsPath.writeFile('/usr/local/1.html', content function(err){
console.log('ok');
});
Sync version of writeFile(). Throws exception on error.
FAQs
file and directory op libs, find, findSync, mkdir, mkdirSync, copy, copySync, remove, removeSync, writeFile, writeFileSync
The npm package fs-path receives a total of 4,050 weekly downloads. As such, fs-path popularity was classified as popular.
We found that fs-path 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.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.
Security News
AI-generated slop reports are making bug bounty triage harder, wasting maintainer time, and straining trust in vulnerability disclosure programs.