Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

nodejs get all folders in directory

const { readdirSync } = require('fs')

const getDirectories = source =>
  readdirSync(source, { withFileTypes: true })
    .filter(dirent => dirent.isDirectory())
    .map(dirent => dirent.name)
Comment

get all from dir node

const getAllFromDir = source =>
      fs.readdirSync(source).map(name => path.join(source, name));
      console.log(getDirectories("C:/"));
Comment

PREVIOUS NEXT
Code Example
Javascript :: ajax call do something while 
Javascript :: splidejs pause 
Javascript :: integers to space separated string in javascript 
Javascript :: expressjs swagger yaml 
Javascript :: how to generate random rgb color number in javascript 
Javascript :: react, scroll element into view 
Javascript :: vue dev server proxy not working 
Javascript :: sum of numbers array using for loop in javascript 
Javascript :: java password regex 
Javascript :: efi javascript 
Javascript :: web-vitals react 
Javascript :: sequelize test connection 
Javascript :: mongodb add admin user 
Javascript :: js remove special characters 
Javascript :: link script react17 
Javascript :: nuxt js emit event 
Javascript :: lodash filter object keys 
Javascript :: how to run a function when the window is closing javascript 
Javascript :: close tab using jquery 
Javascript :: call function on modal open 
Javascript :: bootstrap in react 
Javascript :: nodejs check if express started 
Javascript :: js location 
Javascript :: How to create react app with yarn, npx or npm 
Javascript :: jquery validate checkbox before submit 
Javascript :: jquery index of element 
Javascript :: inline if else javascript 
Javascript :: angular right click 
Javascript :: revert back to css 
Javascript :: if checkbox is checked open modal popup 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =