UNPKG

929 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.statSync = exports.stat = void 0;
4const async = require("./providers/async");
5const sync = require("./providers/sync");
6const settings_1 = require("./settings");
7function stat(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.stat = stat;
15function statSync(path, optionsOrSettings) {
16 const settings = getSettings(optionsOrSettings);
17 return sync.read(path, settings);
18}
19exports.statSync = statSync;
20function getSettings(settingsOrOptions = {}) {
21 if (settingsOrOptions instanceof settings_1.Settings) {
22 return settingsOrOptions;
23 }
24 return new settings_1.Settings(settingsOrOptions);
25}