Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View quantumsheep's full-sized avatar
🐑
S H E E P

Nathanael Demacon quantumsheep

🐑
S H E E P
View GitHub Profile
@quantumsheep
quantumsheep / walk.js
Created October 15, 2018 21:50 — forked from kethinov/walksync.js
List all files in a directory in Node.js recursively in a synchronous fashion
// List all files in a directory in Node.js recursively in an asynchronous fashion
const fs = require('fs').promises;
const path = require('path');
const walk = async (dir, filelist = []) => {
const files = await fs.readdir(dir);
for (file of files) {
const filepath = path.join(dir, file);
const stat = await fs.stat(filepath);