* Asynchronously gets the stats of a file. * @param {string | Buffer | URL} path * @param {{ bigint?: boolean, signal?: AbortSignal }} [options] * @param {( * err?: Error, * stats?: Stats * ) => any} callback * @returns {void}
(path, options = { __proto__: null, bigint: false, throwIfNoEntry: true }, callback)
| 1961 | * @returns {void} |
| 1962 | */ |
| 1963 | function stat(path, options = { __proto__: null, bigint: false, throwIfNoEntry: true }, callback) { |
| 1964 | if (typeof options === 'function') { |
| 1965 | callback = options; |
| 1966 | options = kEmptyObject; |
| 1967 | } else if (options === null || typeof options !== 'object') { |
| 1968 | options = kEmptyObject; |
| 1969 | } else { |
| 1970 | options = getOptions(options, { bigint: false }); |
| 1971 | } |
| 1972 | |
| 1973 | const h = vfsState.handlers; |
| 1974 | if (h !== null && vfsResult(h.stat(path, options), callback)) return; |
| 1975 | |
| 1976 | callback = makeStatsCallback(callback); |
| 1977 | path = getValidatedPath(path); |
| 1978 | |
| 1979 | if (checkAborted(options.signal, callback)) return; |
| 1980 | |
| 1981 | const req = new FSReqCallback(options.bigint); |
| 1982 | req.oncomplete = callback; |
| 1983 | binding.stat(getValidatedPath(path), options.bigint, req, options.throwIfNoEntry); |
| 1984 | } |
| 1985 | |
| 1986 | function statfs(path, options = { __proto__: null, bigint: false }, callback) { |
| 1987 | if (typeof options === 'function') { |
no test coverage detected
searching dependent graphs…