"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs");
const path = require("path");
var FS;
(function (FS) {
    function walkSync(dirpath, deep = true, process, finish) {
        process = process ? process : (stats, root, name) => { return true; };
        finish = finish ? finish : (error) => { };
        try {
            const files = fs.readdirSync(dirpath);
            for (const fn of files) {
                const fp = path.join(dirpath, fn);
                const fstat = fs.statSync(fp);
                const next = process(fstat, dirpath, fn);
                if (!next) {
                    break;
                }
                if (deep && fstat.isDirectory()) {
                    walkSync(fp, deep, process, (error) => {
                        throw error;
                    });
                }
            }
            finish(undefined);
        }
        catch (error) {
            finish(error);
        }
    }
    FS.walkSync = walkSync;
})(FS = exports.FS || (exports.FS = {}));
//# sourceMappingURL=fs.js.map