UNPKG

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