zents
Version:
ZenTS is a Node.js & TypeScript MVC-Framework for building rich web applications, released as free and open-source software under the MIT License. It is designed for building web applications with modern tools and design patterns.
26 lines • 771 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.readDirRecursive = void 0;
const fs_1 = require("fs");
const path_1 = require("path");
/**
* Generator function to read the content of a directory recursively.
*
* @param dir A absolute path to a folder
*/
async function* readDirRecursive(dir) {
const dirContent = await fs_1.promises.readdir(dir, {
withFileTypes: true,
});
for (const content of dirContent) {
const file = path_1.resolve(dir, content.name);
if (content.isDirectory()) {
yield* readDirRecursive(file);
}
else {
yield file;
}
}
}
exports.readDirRecursive = readDirRecursive;
//# sourceMappingURL=readDirRecursiveGenerator.js.map