schnee effeckt und fehler Korektur
This commit is contained in:
51
node_modules/path-type/index.d.ts
generated
vendored
Normal file
51
node_modules/path-type/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
export type PathTypeFunction = (path: string) => Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Check whether the passed `path` is a file.
|
||||
*
|
||||
* @param path - The path to check.
|
||||
* @returns Whether the `path` is a file.
|
||||
*/
|
||||
export const isFile: PathTypeFunction;
|
||||
|
||||
/**
|
||||
* Check whether the passed `path` is a directory.
|
||||
*
|
||||
* @param path - The path to check.
|
||||
* @returns Whether the `path` is a directory.
|
||||
*/
|
||||
export const isDirectory: PathTypeFunction;
|
||||
|
||||
/**
|
||||
* Check whether the passed `path` is a symlink.
|
||||
*
|
||||
* @param path - The path to check.
|
||||
* @returns Whether the `path` is a symlink.
|
||||
*/
|
||||
export const isSymlink: PathTypeFunction;
|
||||
|
||||
export type PathTypeSyncFunction = (path: string) => boolean;
|
||||
|
||||
/**
|
||||
* Synchronously check whether the passed `path` is a file.
|
||||
*
|
||||
* @param path - The path to check.
|
||||
* @returns Whether the `path` is a file.
|
||||
*/
|
||||
export const isFileSync: PathTypeSyncFunction;
|
||||
|
||||
/**
|
||||
* Synchronously check whether the passed `path` is a directory.
|
||||
*
|
||||
* @param path - The path to check.
|
||||
* @returns Whether the `path` is a directory.
|
||||
*/
|
||||
export const isDirectorySync: PathTypeSyncFunction;
|
||||
|
||||
/**
|
||||
* Synchronously check whether the passed `path` is a symlink.
|
||||
*
|
||||
* @param path - The path to check.
|
||||
* @returns Whether the `path` is a directory.
|
||||
*/
|
||||
export const isSymlinkSync: PathTypeSyncFunction;
|
||||
52
node_modules/path-type/index.js
generated
vendored
52
node_modules/path-type/index.js
generated
vendored
@@ -1,29 +1,43 @@
|
||||
'use strict';
|
||||
var fs = require('graceful-fs');
|
||||
var Promise = require('pinkie-promise');
|
||||
var pify = require('pify');
|
||||
const {promisify} = require('util');
|
||||
const fs = require('fs');
|
||||
|
||||
function type(fn, fn2, fp) {
|
||||
if (typeof fp !== 'string') {
|
||||
return Promise.reject(new TypeError('Expected a string'));
|
||||
async function isType(fsStatType, statsMethodName, filePath) {
|
||||
if (typeof filePath !== 'string') {
|
||||
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
||||
}
|
||||
|
||||
return pify(fs[fn], Promise)(fp).then(function (stats) {
|
||||
return stats[fn2]();
|
||||
});
|
||||
try {
|
||||
const stats = await promisify(fs[fsStatType])(filePath);
|
||||
return stats[statsMethodName]();
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
return false;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
function typeSync(fn, fn2, fp) {
|
||||
if (typeof fp !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
function isTypeSync(fsStatType, statsMethodName, filePath) {
|
||||
if (typeof filePath !== 'string') {
|
||||
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
||||
}
|
||||
|
||||
return fs[fn](fp)[fn2]();
|
||||
try {
|
||||
return fs[fsStatType](filePath)[statsMethodName]();
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
return false;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
exports.file = type.bind(null, 'stat', 'isFile');
|
||||
exports.dir = type.bind(null, 'stat', 'isDirectory');
|
||||
exports.symlink = type.bind(null, 'lstat', 'isSymbolicLink');
|
||||
exports.fileSync = typeSync.bind(null, 'statSync', 'isFile');
|
||||
exports.dirSync = typeSync.bind(null, 'statSync', 'isDirectory');
|
||||
exports.symlinkSync = typeSync.bind(null, 'lstatSync', 'isSymbolicLink');
|
||||
exports.isFile = isType.bind(null, 'stat', 'isFile');
|
||||
exports.isDirectory = isType.bind(null, 'stat', 'isDirectory');
|
||||
exports.isSymlink = isType.bind(null, 'lstat', 'isSymbolicLink');
|
||||
exports.isFileSync = isTypeSync.bind(null, 'statSync', 'isFile');
|
||||
exports.isDirectorySync = isTypeSync.bind(null, 'statSync', 'isDirectory');
|
||||
exports.isSymlinkSync = isTypeSync.bind(null, 'lstatSync', 'isSymbolicLink');
|
||||
|
||||
20
node_modules/path-type/license
generated
vendored
20
node_modules/path-type/license
generated
vendored
@@ -1,21 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
93
node_modules/path-type/package.json
generated
vendored
93
node_modules/path-type/package.json
generated
vendored
@@ -1,52 +1,45 @@
|
||||
{
|
||||
"name": "path-type",
|
||||
"version": "1.1.0",
|
||||
"description": "Check if a path is a file, directory, or symlink",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/path-type",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"path",
|
||||
"fs",
|
||||
"type",
|
||||
"is",
|
||||
"check",
|
||||
"directory",
|
||||
"dir",
|
||||
"file",
|
||||
"filepath",
|
||||
"symlink",
|
||||
"symbolic",
|
||||
"link",
|
||||
"stat",
|
||||
"stats",
|
||||
"filesystem"
|
||||
],
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.1.2",
|
||||
"pify": "^2.0.0",
|
||||
"pinkie-promise": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"ignores": [
|
||||
"test.js"
|
||||
]
|
||||
}
|
||||
"name": "path-type",
|
||||
"version": "4.0.0",
|
||||
"description": "Check if a path is a file, directory, or symlink",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/path-type",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava && tsd-check"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"path",
|
||||
"fs",
|
||||
"type",
|
||||
"is",
|
||||
"check",
|
||||
"directory",
|
||||
"dir",
|
||||
"file",
|
||||
"filepath",
|
||||
"symlink",
|
||||
"symbolic",
|
||||
"link",
|
||||
"stat",
|
||||
"stats",
|
||||
"filesystem"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.3.1",
|
||||
"nyc": "^13.3.0",
|
||||
"tsd-check": "^0.3.0",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
||||
|
||||
58
node_modules/path-type/readme.md
generated
vendored
58
node_modules/path-type/readme.md
generated
vendored
@@ -6,37 +6,67 @@
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save path-type
|
||||
$ npm install path-type
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var pathType = require('path-type');
|
||||
const {isFile} = require('path-type');
|
||||
|
||||
pathType.file('package.json').then(function (isFile) {
|
||||
console.log(isFile);
|
||||
(async () => {
|
||||
console.log(await isFile('package.json'));
|
||||
//=> true
|
||||
})
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### .file(path)
|
||||
### .dir(path)
|
||||
### .symlink(path)
|
||||
### isFile(path)
|
||||
|
||||
Returns a promise that resolves to a boolean of whether the path is the checked type.
|
||||
Check whether the passed `path` is a file.
|
||||
|
||||
### .fileSync(path)
|
||||
### .dirSync(path)
|
||||
### .symlinkSync(path)
|
||||
Returns a `Promise<boolean>`.
|
||||
|
||||
Returns a boolean of whether the path is the checked type.
|
||||
#### path
|
||||
|
||||
Type: `string`
|
||||
|
||||
The path to check.
|
||||
|
||||
### isDirectory(path)
|
||||
|
||||
Check whether the passed `path` is a directory.
|
||||
|
||||
Returns a `Promise<boolean>`.
|
||||
|
||||
### isSymlink(path)
|
||||
|
||||
Check whether the passed `path` is a symlink.
|
||||
|
||||
Returns a `Promise<boolean>`.
|
||||
|
||||
### isFileSync(path)
|
||||
|
||||
Synchronously check whether the passed `path` is a file.
|
||||
|
||||
Returns a `boolean`.
|
||||
|
||||
### isDirectorySync(path)
|
||||
|
||||
Synchronously check whether the passed `path` is a directory.
|
||||
|
||||
Returns a `boolean`.
|
||||
|
||||
### isSymlinkSync(path)
|
||||
|
||||
Synchronously check whether the passed `path` is a symlink.
|
||||
|
||||
Returns a `boolean`.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
|
||||
Reference in New Issue
Block a user