🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

files-in-dir

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

files-in-dir

Get file names within a directory

1.0.0
latest
Source
npm
Version published
Maintainers
1
Created
Source

Get file names in a directory

Examples

Normal usage:

const filesInDir = require('files-in-dir');
const fileNames = filesInDir('/home/fred/Desktop');
console.log(fileNames);
// ['image_1.jpg', 'resume.pdf', 'why_worry.PNG'...]

Require specific extension(s):

const allowdExtensions = ['jpg', 'png']; // case insensitive
const someFileNames = filesInDir('/home/fred/Desktop', allowdExtensions);
console.log(someFileNames);
// ['image_1.jpg', 'why_worry.PNG'...]

Use dirs-in-dir to get directory names in a directory

Keywords

file

FAQs

Package last updated on 27 Apr 2019

Did you know?

Socket

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.

Install

Related posts