Skip to content

Instantly share code, notes, and snippets.

@bennycode
Created May 22, 2021 10:52
Show Gist options
  • Select an option

  • Save bennycode/54f80c0a767873ee2645c1eb0c7740c0 to your computer and use it in GitHub Desktop.

Select an option

Save bennycode/54f80c0a767873ee2645c1eb0c7740c0 to your computer and use it in GitHub Desktop.
List all files in a directory (Node.js)
const fs = require('fs');
const testFolder = './test/';
fs.readdirSync(testFolder).forEach(file => {
console.log(file);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment