Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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)
 
PREVIOUS NEXT
Tagged: #nodejs #folders #directory
ADD COMMENT
Topic
Name
2+5 =