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.
Ensure file, folder, link or symlink existence in file system for node fs module
Module that add ensure functionality to node fs module
enfs stands for [E]asy [N]ode [fs]
This module is intended to work as a sub-module of enfs
This module will add various method that allows the user to ensure the creation of a file, directory, link or symlink in the file system, if the parent directory of the item to be ensured don't exist it will be automatically created.
ensureFile
ensureFileSync
ensureDir
ensureDirSync
ensureLink
ensureLinkSync
ensureSymlink
ensureSymlinkSync
enfsensure
var enfsensure = require("enfsensure");
All the methods follows the node culture.
Ensures the file existence in the file system, if the file don't exist it will be created.
[options]:
Sync: * ensureFileSync(path,[options])
enfsensure.ensureFile("/path/to/any/file",{ data: "contents", encoding: "utf8" },function(err){
if(!err){
console.log("data was written to the file");
}
});
Stream
enfsensure.ensureFile("/path/to/any/file",{ stream: true, streamOptions: { autoClose: true} },function(err, stream){
if(!err){
console.log("stream is a WriteStream object.");
}
});
Ensure directory existence in the file system, if directory don't exist it will be created
[options]:
Sync: * ensureDirSync(path,[options])
enfsensure.ensureDir("/path/to/the/new/folder", function(err, path){
if(!err){
console.log("directory was created in the path: "+path);
}
});
Ensure link creation in the file system. link
[options]:
Sync: * ensureLinkSync(srcPath, dstPath, [options])
enfsensure.ensureLink("/srcPath", "/dstPath", function(err, dstPath){
//do something
});
Ensure symlink creation in the file system. symlink
[options]:
Sync: * ensureSymlinkSync(path,[options])
enfsensure.ensureSymlink("./foo", "./new-port", "file", function(err, dstPath){
//do something
});
Creative Commons Attribution 4.0 International License
Copyright (c) 2016 Joao Parreira joaofrparreira@gmail.com GitHub
This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit CC-BY-4.0.
FAQs
Ensure file, folder, link or symlink existence in file system for node fs module
We found that enfsensure 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’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.