| Server IP : 34.87.99.72 / Your IP : 216.73.217.31 Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 User : bitnami ( 1000) PHP Version : 7.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /home/bitnami/htdocs/app/node_modules/@nodelib/fs.walk/src/ |
Upload File : |
import * as path from 'path';
import * as fsScandir from '@nodelib/fs.scandir';
import { Entry, Errno } from './types';
export type FilterFunction<T> = (value: T) => boolean;
export type DeepFilterFunction = FilterFunction<Entry>;
export type EntryFilterFunction = FilterFunction<Entry>;
export type ErrorFilterFunction = FilterFunction<Errno>;
export type Options = {
basePath?: string;
concurrency?: number;
deepFilter?: DeepFilterFunction;
entryFilter?: EntryFilterFunction;
errorFilter?: ErrorFilterFunction;
followSymbolicLinks?: boolean;
fs?: Partial<fsScandir.FileSystemAdapter>;
pathSegmentSeparator?: string;
stats?: boolean;
throwErrorOnBrokenSymbolicLink?: boolean;
};
export default class Settings {
public readonly basePath?: string = this._getValue(this._options.basePath, undefined);
public readonly concurrency: number = this._getValue(this._options.concurrency, Infinity);
public readonly deepFilter: DeepFilterFunction | null = this._getValue(this._options.deepFilter, null);
public readonly entryFilter: EntryFilterFunction | null = this._getValue(this._options.entryFilter, null);
public readonly errorFilter: ErrorFilterFunction | null = this._getValue(this._options.errorFilter, null);
public readonly pathSegmentSeparator: string = this._getValue(this._options.pathSegmentSeparator, path.sep);
public readonly fsScandirSettings: fsScandir.Settings = new fsScandir.Settings({
followSymbolicLinks: this._options.followSymbolicLinks,
fs: this._options.fs,
pathSegmentSeparator: this._options.pathSegmentSeparator,
stats: this._options.stats,
throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
});
constructor(private readonly _options: Options = {}) { }
private _getValue<T>(option: T | undefined, value: T): T {
return option ?? value;
}
}