aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@nodelib/fs.stat
diff options
context:
space:
mode:
authorDimitri Staessens <[email protected]>2019-10-06 21:37:45 +0200
committerDimitri Staessens <[email protected]>2019-10-06 21:37:45 +0200
commit3c51c3be85bb0d1bdb87ea0d6632f1c256912f27 (patch)
treec7ccc8279b12c4f7bdbbb4270d617e48f51722e4 /node_modules/@nodelib/fs.stat
parent412c104bebc507bea9c94fd53b5bdc4b64cbfe31 (diff)
downloadwebsite-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.tar.gz
website-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.zip
build: Add some required modules for node
Diffstat (limited to 'node_modules/@nodelib/fs.stat')
-rw-r--r--node_modules/@nodelib/fs.stat/README.md92
-rw-r--r--node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts11
-rw-r--r--node_modules/@nodelib/fs.stat/out/adapters/fs.js16
-rw-r--r--node_modules/@nodelib/fs.stat/out/index.d.ts22
-rw-r--r--node_modules/@nodelib/fs.stat/out/index.js31
-rw-r--r--node_modules/@nodelib/fs.stat/out/managers/options.d.ts11
-rw-r--r--node_modules/@nodelib/fs.stat/out/managers/options.js12
-rw-r--r--node_modules/@nodelib/fs.stat/out/providers/stat.d.ts11
-rw-r--r--node_modules/@nodelib/fs.stat/out/providers/stat.js45
-rw-r--r--node_modules/@nodelib/fs.stat/package.json61
10 files changed, 312 insertions, 0 deletions
diff --git a/node_modules/@nodelib/fs.stat/README.md b/node_modules/@nodelib/fs.stat/README.md
new file mode 100644
index 0000000..3f7b835
--- /dev/null
+++ b/node_modules/@nodelib/fs.stat/README.md
@@ -0,0 +1,92 @@
+# @nodelib/fs.stat
+
+> Get the status of a file with some features.
+
+## :bulb: Highlights
+
+Wrapper over standard methods ([`fs.lstat`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_lstat_path_callback), [`fs.stat`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_stat_path_callback)) with some features.
+
+ * :beginner: Normally follows symlinks.
+ * :gear: Can safely work with broken symlinks (returns information about symlink instead of generating an error).
+
+## Install
+
+```
+$ npm install @nodelib/fs.stat
+```
+
+## Usage
+
+```js
+const fsStat = require('@nodelib/fs.stat');
+
+fsStat.stat('path').then((stat) => {
+ console.log(stat); // => fs.Stats
+});
+```
+
+## API
+
+### fsStat.stat(path, [options])
+
+Returns a [`Promise<fs.Stats>`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_class_fs_stats) for provided path.
+
+### fsStat.statSync(path, [options])
+
+Returns a [`fs.Stats`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_class_fs_stats) for provided path.
+
+### fsStat.statCallback(path, [options], callback)
+
+Returns a [`fs.Stats`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_class_fs_stats) for provided path with standard callback-style.
+
+#### path
+
+ * Type: `string | Buffer | URL`
+
+The `path` argument for [`fs.lstat`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_lstat_path_callback) or [`fs.stat`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_stat_path_callback) method.
+
+#### options
+
+ * Type: `Object`
+
+See [options](#options-1) section for more detailed information.
+
+## Options
+
+### throwErrorOnBrokenSymlinks
+
+ * Type: `boolean`
+ * Default: `true`
+
+Throw an error or return information about symlink, when symlink is broken. When `false`, methods will be return lstat call for broken symlinks.
+
+### followSymlinks
+
+ * Type: `boolean`
+ * Default: `true`
+
+By default, the methods of this package follows symlinks. If you do not want it, set this option to `false` or use the standard method [`fs.lstat`](https://nodejs.org/dist/latest/docs/api/fs.html#fs_fs_lstat_path_callback).
+
+### fs
+
+ * Type: `FileSystemAdapter`
+ * Default: `built-in FS methods`
+
+By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace each method with your own.
+
+```ts
+interface FileSystemAdapter {
+ lstat?: typeof fs.lstat;
+ stat?: typeof fs.stat;
+ lstatSync?: typeof fs.lstatSync;
+ statSync?: typeof fs.statSync;
+}
+```
+
+## Changelog
+
+See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelogs for each release version.
+
+## License
+
+This software is released under the terms of the MIT license.
diff --git a/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts b/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts
new file mode 100644
index 0000000..a8e6117
--- /dev/null
+++ b/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts
@@ -0,0 +1,11 @@
+/// <reference types="node" />
+import * as fs from 'fs';
+export interface FileSystemAdapter {
+ lstat: typeof fs.lstat;
+ stat: typeof fs.stat;
+ lstatSync: typeof fs.lstatSync;
+ statSync: typeof fs.statSync;
+}
+export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter;
+export declare function getFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter;
+//# sourceMappingURL=fs.d.ts.map \ No newline at end of file
diff --git a/node_modules/@nodelib/fs.stat/out/adapters/fs.js b/node_modules/@nodelib/fs.stat/out/adapters/fs.js
new file mode 100644
index 0000000..30319b6
--- /dev/null
+++ b/node_modules/@nodelib/fs.stat/out/adapters/fs.js
@@ -0,0 +1,16 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+const fs = require("fs");
+exports.FILE_SYSTEM_ADAPTER = {
+ lstat: fs.lstat,
+ stat: fs.stat,
+ lstatSync: fs.lstatSync,
+ statSync: fs.statSync
+};
+function getFileSystemAdapter(fsMethods) {
+ if (!fsMethods) {
+ return exports.FILE_SYSTEM_ADAPTER;
+ }
+ return Object.assign({}, exports.FILE_SYSTEM_ADAPTER, fsMethods);
+}
+exports.getFileSystemAdapter = getFileSystemAdapter;
diff --git a/node_modules/@nodelib/fs.stat/out/index.d.ts b/node_modules/@nodelib/fs.stat/out/index.d.ts
new file mode 100644
index 0000000..bda407d
--- /dev/null
+++ b/node_modules/@nodelib/fs.stat/out/index.d.ts
@@ -0,0 +1,22 @@
+/// <reference types="node" />
+import * as fs from 'fs';
+import { FileSystemAdapter } from './adapters/fs';
+import { Options } from './managers/options';
+import { AsyncCallback } from './providers/stat';
+/**
+ * Asynchronous API.
+ */
+export declare function stat(path: fs.PathLike, opts?: Options): Promise<fs.Stats>;
+/**
+ * Callback API.
+ */
+export declare function statCallback(path: fs.PathLike, callback: AsyncCallback): void;
+export declare function statCallback(path: fs.PathLike, opts: Options, callback: AsyncCallback): void;
+/**
+ * Synchronous API.
+ */
+export declare function statSync(path: fs.PathLike, opts?: Options): fs.Stats;
+export declare type Options = Options;
+export declare type StatAsyncCallback = AsyncCallback;
+export declare type FileSystemAdapter = FileSystemAdapter;
+//# sourceMappingURL=index.d.ts.map \ No newline at end of file
diff --git a/node_modules/@nodelib/fs.stat/out/index.js b/node_modules/@nodelib/fs.stat/out/index.js
new file mode 100644
index 0000000..26c5ba8
--- /dev/null
+++ b/node_modules/@nodelib/fs.stat/out/index.js
@@ -0,0 +1,31 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+const optionsManager = require("./managers/options");
+const statProvider = require("./providers/stat");
+/**
+ * Asynchronous API.
+ */
+function stat(path, opts) {
+ return new Promise((resolve, reject) => {
+ statProvider.async(path, optionsManager.prepare(opts), (err, stats) => err ? reject(err) : resolve(stats));
+ });
+}
+exports.stat = stat;
+function statCallback(path, optsOrCallback, callback) {
+ if (typeof optsOrCallback === 'function') {
+ callback = optsOrCallback; /* tslint:disable-line: no-parameter-reassignment */
+ optsOrCallback = undefined; /* tslint:disable-line: no-parameter-reassignment */
+ }
+ if (typeof callback === 'undefined') {
+ throw new TypeError('The "callback" argument must be of type Function.');
+ }
+ statProvider.async(path, optionsManager.prepare(optsOrCallback), callback);
+}
+exports.statCallback = statCallback;
+/**
+ * Synchronous API.
+ */
+function statSync(path, opts) {
+ return statProvider.sync(path, optionsManager.prepare(opts));
+}
+exports.statSync = statSync;
diff --git a/node_modules/@nodelib/fs.stat/out/managers/options.d.ts b/node_modules/@nodelib/fs.stat/out/managers/options.d.ts
new file mode 100644
index 0000000..6e2e9b0
--- /dev/null
+++ b/node_modules/@nodelib/fs.stat/out/managers/options.d.ts
@@ -0,0 +1,11 @@
+import { FileSystemAdapter } from '../adapters/fs';
+export interface Options {
+ fs?: Partial<FileSystemAdapter>;
+ throwErrorOnBrokenSymlinks?: boolean;
+ followSymlinks?: boolean;
+}
+export declare type StrictOptions = {
+ fs: FileSystemAdapter;
+} & Required<Options>;
+export declare function prepare(opts?: Options): StrictOptions;
+//# sourceMappingURL=options.d.ts.map \ No newline at end of file
diff --git a/node_modules/@nodelib/fs.stat/out/managers/options.js b/node_modules/@nodelib/fs.stat/out/managers/options.js
new file mode 100644
index 0000000..ae52922
--- /dev/null
+++ b/node_modules/@nodelib/fs.stat/out/managers/options.js
@@ -0,0 +1,12 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+const fsAdapter = require("../adapters/fs");
+function prepare(opts) {
+ const options = Object.assign({
+ fs: fsAdapter.getFileSystemAdapter(opts ? opts.fs : undefined),
+ throwErrorOnBrokenSymlinks: true,
+ followSymlinks: true
+ }, opts);
+ return options;
+}
+exports.prepare = prepare;
diff --git a/node_modules/@nodelib/fs.stat/out/providers/stat.d.ts b/node_modules/@nodelib/fs.stat/out/providers/stat.d.ts
new file mode 100644
index 0000000..47c0bd1
--- /dev/null
+++ b/node_modules/@nodelib/fs.stat/out/providers/stat.d.ts
@@ -0,0 +1,11 @@
+/// <reference types="node" />
+import * as fs from 'fs';
+import { StrictOptions } from '../managers/options';
+export declare function sync(path: fs.PathLike, options: StrictOptions): fs.Stats;
+export declare type AsyncCallback = (err: NodeJS.ErrnoException | null, stats?: fs.Stats) => void;
+export declare function async(path: fs.PathLike, options: StrictOptions, callback: AsyncCallback): void;
+/**
+ * Returns `true` for followed symlink.
+ */
+export declare function isFollowedSymlink(stat: fs.Stats, options: StrictOptions): boolean;
+//# sourceMappingURL=stat.d.ts.map \ No newline at end of file
diff --git a/node_modules/@nodelib/fs.stat/out/providers/stat.js b/node_modules/@nodelib/fs.stat/out/providers/stat.js
new file mode 100644
index 0000000..a7bbc52
--- /dev/null
+++ b/node_modules/@nodelib/fs.stat/out/providers/stat.js
@@ -0,0 +1,45 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+function sync(path, options) {
+ const lstat = options.fs.lstatSync(path);
+ if (!isFollowedSymlink(lstat, options)) {
+ return lstat;
+ }
+ try {
+ const stat = options.fs.statSync(path);
+ stat.isSymbolicLink = () => true;
+ return stat;
+ }
+ catch (err) {
+ if (!options.throwErrorOnBrokenSymlinks) {
+ return lstat;
+ }
+ throw err;
+ }
+}
+exports.sync = sync;
+function async(path, options, callback) {
+ options.fs.lstat(path, (err0, lstat) => {
+ if (err0) {
+ return callback(err0, undefined);
+ }
+ if (!isFollowedSymlink(lstat, options)) {
+ return callback(null, lstat);
+ }
+ options.fs.stat(path, (err1, stat) => {
+ if (err1) {
+ return options.throwErrorOnBrokenSymlinks ? callback(err1) : callback(null, lstat);
+ }
+ stat.isSymbolicLink = () => true;
+ callback(null, stat);
+ });
+ });
+}
+exports.async = async;
+/**
+ * Returns `true` for followed symlink.
+ */
+function isFollowedSymlink(stat, options) {
+ return stat.isSymbolicLink() && options.followSymlinks;
+}
+exports.isFollowedSymlink = isFollowedSymlink;
diff --git a/node_modules/@nodelib/fs.stat/package.json b/node_modules/@nodelib/fs.stat/package.json
new file mode 100644
index 0000000..e8beb3b
--- /dev/null
+++ b/node_modules/@nodelib/fs.stat/package.json
@@ -0,0 +1,61 @@
+{
+ "_args": [
+ [
+ "@nodelib/[email protected]",
+ "/home/dstaesse/git/website"
+ ]
+ ],
+ "_development": true,
+ "_from": "@nodelib/[email protected]",
+ "_id": "@nodelib/[email protected]",
+ "_inBundle": false,
+ "_integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==",
+ "_location": "/@nodelib/fs.stat",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "@nodelib/[email protected]",
+ "name": "@nodelib/fs.stat",
+ "escapedName": "@nodelib%2ffs.stat",
+ "scope": "@nodelib",
+ "rawSpec": "1.1.3",
+ "saveSpec": null,
+ "fetchSpec": "1.1.3"
+ },
+ "_requiredBy": [
+ "/fast-glob"
+ ],
+ "_resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz",
+ "_spec": "1.1.3",
+ "_where": "/home/dstaesse/git/website",
+ "description": "Get the status of a file with some features",
+ "engines": {
+ "node": ">= 6"
+ },
+ "keywords": [
+ "NodeLib",
+ "fs",
+ "FileSystem",
+ "file system",
+ "stat"
+ ],
+ "license": "MIT",
+ "main": "out/index.js",
+ "name": "@nodelib/fs.stat",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.stat"
+ },
+ "scripts": {
+ "build": "npm run clean && npm run lint && npm run compile && npm test",
+ "clean": "rimraf out",
+ "compile": "tsc -b .",
+ "compile:watch": "tsc -p . --watch --sourceMap",
+ "lint": "tslint \"src/**/*.ts\" -p . -t stylish",
+ "test": "mocha \"out/**/*.spec.js\" -s 0",
+ "watch": "npm run clean && npm run compile:watch"
+ },
+ "typings": "out/index.d.ts",
+ "version": "1.1.3"
+}