Socket
Socket
Sign inDemoInstall

yu-node

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yu-node - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

16

lib/getAllFiles.js
const fs = require('fs');
const path = require('path');
exports.getAllFiles = dirPath => {
exports.getAllFiles = (dirPath, recursion=true) => {
const bool = fs.existsSync(dirPath); //判断目录是否存在

@@ -9,16 +9,18 @@ if(!bool) return;

let arr = [];
fn(dirPath);
function fn(dirPath){
(function fn(dirPath){
const dirents = fs.readdirSync(dirPath,{ withFileTypes:true });
dirents.forEach((dirent,i)=>{
dirents.forEach(dirent=>{
let child = path.join(dirPath,dirent.name);
if(dirent.isDirectory()){
fn(child);
recursion && fn(child);
}else{
arr.push(path.resolve(dirPath,'../',child));
arr.push(path.resolve(child));
}
});
}
})(dirPath);
return arr;
}
{
"name": "yu-node",
"version": "1.0.6",
"version": "1.0.7",
"description": "仅用于node.js",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc