| //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); | |
| }); | |
| }); |
Get List of all files in a directory in Node.js
https://medium.com/stackfame/get-list-of-all-files-in-a-directory-in-node-js-befd31677ec5
Đăng ký:
Đăng Nhận xét (Atom)
api feed with published=false?
Câu trả lời ngắn gọn là: CÓ . Trên thực tế, đây chính là cách chuẩn nhất để tạo các bài viết chưa hiển thị công khai (bao gồm Bản nháp, B...
-
Source: https://indepth.dev/stop-using-shared-material-module/ This article describes an experiment that shows why using the SharedMate...
-
html5 video - What is a blob URL and why it is used? - Stack Overflow Blob URLs (ref W3C , official name) or Object-URLs (ref. MDN and ...
-
Basic usage | Documentation | Poetry - Python dependency management and packaging made easy (python-poetry.org) Activating the virtual env...
Không có nhận xét nào:
Đăng nhận xét