Socket
Socket
Sign inDemoInstall

@nodelib/fs.stat

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.5 to 3.0.0

out/stat.d.ts

6

out/adapters/fs.d.ts
/// <reference types="node" />
import * as fs from 'fs';
import * as fs from 'node:fs';
import type { ErrnoException } from '../types';
export declare type StatAsynchronousMethod = (path: string, callback: (error: ErrnoException | null, stats: fs.Stats) => void) => void;
export declare type StatSynchronousMethod = (path: string) => fs.Stats;
export type StatAsynchronousMethod = (path: string, callback: (error: ErrnoException | null, stats: fs.Stats) => void) => void;
export type StatSynchronousMethod = (path: string) => fs.Stats;
export interface FileSystemAdapter {

@@ -7,0 +7,0 @@ lstat: StatAsynchronousMethod;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
const fs = require("fs");
const fs = require("node:fs");
exports.FILE_SYSTEM_ADAPTER = {

@@ -9,3 +9,3 @@ lstat: fs.lstat,

lstatSync: fs.lstatSync,
statSync: fs.statSync
statSync: fs.statSync,
};

@@ -16,4 +16,7 @@ function createFileSystemAdapter(fsMethods) {

}
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
return {
...exports.FILE_SYSTEM_ADAPTER,
...fsMethods,
};
}
exports.createFileSystemAdapter = createFileSystemAdapter;

@@ -1,12 +0,5 @@

import type { FileSystemAdapter, StatAsynchronousMethod, StatSynchronousMethod } from './adapters/fs';
import * as async from './providers/async';
import Settings, { Options } from './settings';
import type { Stats } from './types';
declare type AsyncCallback = async.AsyncCallback;
declare function stat(path: string, callback: AsyncCallback): void;
declare function stat(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void;
declare namespace stat {
function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise<Stats>;
}
declare function statSync(path: string, optionsOrSettings?: Options | Settings): Stats;
export { Settings, stat, statSync, AsyncCallback, FileSystemAdapter, StatAsynchronousMethod, StatSynchronousMethod, Options, Stats };
export { stat, statSync } from './stat';
export { Settings } from './settings';
export type { FileSystemAdapter, StatSynchronousMethod, StatAsynchronousMethod } from './adapters/fs';
export type { Options } from './settings';
export type { Stats, AsyncCallback } from './types';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.statSync = exports.stat = exports.Settings = void 0;
const async = require("./providers/async");
const sync = require("./providers/sync");
const settings_1 = require("./settings");
exports.Settings = settings_1.default;
function stat(path, optionsOrSettingsOrCallback, callback) {
if (typeof optionsOrSettingsOrCallback === 'function') {
async.read(path, getSettings(), optionsOrSettingsOrCallback);
return;
}
async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
}
exports.stat = stat;
function statSync(path, optionsOrSettings) {
const settings = getSettings(optionsOrSettings);
return sync.read(path, settings);
}
exports.statSync = statSync;
function getSettings(settingsOrOptions = {}) {
if (settingsOrOptions instanceof settings_1.default) {
return settingsOrOptions;
}
return new settings_1.default(settingsOrOptions);
}
exports.Settings = exports.statSync = exports.stat = void 0;
var stat_1 = require("./stat");
Object.defineProperty(exports, "stat", { enumerable: true, get: function () { return stat_1.stat; } });
Object.defineProperty(exports, "statSync", { enumerable: true, get: function () { return stat_1.statSync; } });
var settings_1 = require("./settings");
Object.defineProperty(exports, "Settings", { enumerable: true, get: function () { return settings_1.Settings; } });

@@ -1,4 +0,3 @@

import type Settings from '../settings';
import type { ErrnoException, Stats } from '../types';
export declare type AsyncCallback = (error: ErrnoException, stats: Stats) => void;
import type { Settings } from '../settings';
import type { AsyncCallback } from '../types';
export declare function read(path: string, settings: Settings, callback: AsyncCallback): void;

@@ -1,3 +0,3 @@

import type Settings from '../settings';
import type { Settings } from '../settings';
import type { Stats } from '../types';
export declare function read(path: string, settings: Settings): Stats;

@@ -8,4 +8,3 @@ import * as fs from './adapters/fs';

}
export default class Settings {
private readonly _options;
export declare class Settings {
readonly followSymbolicLink: boolean;

@@ -15,4 +14,3 @@ readonly fs: fs.FileSystemAdapter;

readonly throwErrorOnBrokenSymbolicLink: boolean;
constructor(_options?: Options);
private _getValue;
constructor(options?: Options);
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Settings = void 0;
const fs = require("./adapters/fs");
class Settings {
constructor(_options = {}) {
this._options = _options;
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
this.fs = fs.createFileSystemAdapter(this._options.fs);
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
followSymbolicLink;
fs;
markSymbolicLink;
throwErrorOnBrokenSymbolicLink;
constructor(options = {}) {
this.followSymbolicLink = options.followSymbolicLink ?? true;
this.fs = fs.createFileSystemAdapter(options.fs);
this.markSymbolicLink = options.markSymbolicLink ?? false;
this.throwErrorOnBrokenSymbolicLink = options.throwErrorOnBrokenSymbolicLink ?? true;
}
_getValue(option, value) {
return option !== null && option !== void 0 ? option : value;
}
}
exports.default = Settings;
exports.Settings = Settings;
/// <reference types="node" />
import type * as fs from 'fs';
export declare type Stats = fs.Stats;
export declare type ErrnoException = NodeJS.ErrnoException;
/// <reference types="node" />
import type * as fs from 'node:fs';
export type Stats = fs.Stats;
export type ErrnoException = NodeJS.ErrnoException;
export type AsyncCallback = (error: ErrnoException | null, stats: Stats) => void;
{
"name": "@nodelib/fs.stat",
"version": "2.0.5",
"version": "3.0.0",
"description": "Get the status of a file with some features",

@@ -15,3 +15,3 @@ "license": "MIT",

"engines": {
"node": ">= 8"
"node": ">=16.14.0"
},

@@ -29,3 +29,3 @@ "files": [

"compile": "tsc -b .",
"compile:watch": "tsc -p . --watch --sourceMap",
"compile:watch": "tsc -b . --watch --sourceMap",
"test": "mocha \"out/**/*.spec.js\" -s 0",

@@ -36,5 +36,4 @@ "build": "npm run clean && npm run compile && npm run lint && npm test",

"devDependencies": {
"@nodelib/fs.macchiato": "1.0.4"
},
"gitHead": "d6a7960d5281d3dd5f8e2efba49bb552d090f562"
"@nodelib/fs.macchiato": "2.0.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc