get all from dir node
//requiring path and fs modules
const path = require('path');
const fs = require('fs');
//joining path of directory
const directoryPath = path.join(__dirname, 'Documents');
//passsing directoryPath and callback function
fs.readdir(directoryPath, function (err, files) {
//handling error
if (err) {
return console.log('Unable to scan directory: ' + err);
}
//listing all files using forEach
files.forEach(function (file) {
// Do whatever you want to do with the file
console.log(file);
});
});const getAllFromDir = source =>
fs.readdirSync(source).map(name => path.join(source, name));
console.log(getDirectories("C:/"));
Also in JavaScript:
- react select
- aws lambda dynamodb nodejs scan
- get id of first td jquery
- continue foreach javascript
- jquery min
- codemirror get value
- scrollview not working react-native
- how can when click buton scrool to another elemtn
- how to make a div sticky using js
- js any array
- remove element by class
- google gapi auth2 get current token
- how to comment out code in react js
- javascript multidimensional array
- js ask before close chrome
- javascript whitespace strip
- javascript closure inside loop
- These dependencies were not found: * webpack/lib/web/FetchCompileWasmPlugin in ./~/worker-loader/dist/index.js
- js array map skip element
- sort javascript array
- laravel return response json
- créer composant react
- loading screen fivem js
- based on scroll position and get data attribute javascript