UNPKG

953 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.scandirSync = exports.scandir = void 0;
4const settings_1 = require("./settings");
5const async = require("./providers/async");
6const sync = require("./providers/sync");
7function scandir(path, optionsOrSettingsOrCallback, callback) {
8 if (typeof optionsOrSettingsOrCallback === 'function') {
9 async.read(path, getSettings(), optionsOrSettingsOrCallback);
10 return;
11 }
12 async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
13}
14exports.scandir = scandir;
15function scandirSync(path, optionsOrSettings) {
16 const settings = getSettings(optionsOrSettings);
17 return sync.read(path, settings);
18}
19exports.scandirSync = scandirSync;
20function getSettings(settingsOrOptions = {}) {
21 if (settingsOrOptions instanceof settings_1.Settings) {
22 return settingsOrOptions;
23 }
24 return new settings_1.Settings(settingsOrOptions);
25}