Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
list-contents
Advanced tools
Returns a list of paths to the subfolders and subfiles of the specified location.
list-contents
is a module that returns a list of paths to the subfolders and subfiles of the specified location.
file-assistant
package that creates, copies or moves the folders and files into the specified path or modifies the files' content according to the given [Array] object (or .json file path) instructions.v3.*.*
The callback
function object.error
property has been replaced with object.inaccessible
property. If the file or folder is inaccessible, it is pushed into object.inaccessible
array [see below]. Unlike object.error
, if the file or folder is inaccessible, it does not stop retrieving the further files and folders. After retrieving all children items, the callback
function returns the object with dirs
, files
and inaccessible
[Array] properties.npm install list-contents
const list = require('list-contents');
list(path,callback)
path
[String]If the
path
, eg.'./dist/styles'
is inaccessible itself, thecallback
function will return object:
{files:[], dirs:[], inaccessible:[ './' ], path:'./dist/styles'}
callback
[Function]callback
function. It has 4 properties:
error
[Boolean|Error] v2.*.*
null
if the path
is valid, otherwise [Error] objectdirs
[Array]path
argumentfiles
[Array]path
argumentinaccessible
[Array] v3.*.*
path
argumentpath
[String]path
parameterconst list = require('list-contents');
list("./dist",(o)=>{
if(o.error) throw o.error;
console.log('Folders: ', o.dirs);
console.log('Files: ', o.files);
});
Assuming that "./dist" path contains the following subfolders and subfiles:
dist
├ scripts
│ ├ index.js
│ └ ajax.js
├ styles
│ ├ css
│ │ ├ layout.css
│ │ └ media.css
│ └ scss
│ └ mixins.scss
└ templates
├ main.html
├ menubar.html
├ login.html
└ contact.html
the module will pass the following object through the callback
function:
{
error: null,
path: "./dist",
dirs: [
'scripts',
'templates',
'styles',
'styles/css',
'styles/scss'
],
files: [
'scripts/ajax.js',
'scripts/index.js',
'templates/contact.html',
'templates/login.html',
'templates/main.html',
'templates/menubar.html',
'styles/css/layout.css',
'styles/css/media.css',
'styles/scss/mixins.scss'
]
}
FAQs
Returns a list of paths to the subfolders and subfiles of the specified location.
The npm package list-contents receives a total of 258 weekly downloads. As such, list-contents popularity was classified as not popular.
We found that list-contents 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.