Galerie und tage
This commit is contained in:
51
node_modules/path-type/index.d.ts
generated
vendored
51
node_modules/path-type/index.d.ts
generated
vendored
@@ -1,51 +0,0 @@
|
||||
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,43 +1,29 @@
|
||||
'use strict';
|
||||
const {promisify} = require('util');
|
||||
const fs = require('fs');
|
||||
var fs = require('graceful-fs');
|
||||
var Promise = require('pinkie-promise');
|
||||
var pify = require('pify');
|
||||
|
||||
async function isType(fsStatType, statsMethodName, filePath) {
|
||||
if (typeof filePath !== 'string') {
|
||||
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
||||
function type(fn, fn2, fp) {
|
||||
if (typeof fp !== 'string') {
|
||||
return Promise.reject(new TypeError('Expected a string'));
|
||||
}
|
||||
|
||||
try {
|
||||
const stats = await promisify(fs[fsStatType])(filePath);
|
||||
return stats[statsMethodName]();
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
return false;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
return pify(fs[fn], Promise)(fp).then(function (stats) {
|
||||
return stats[fn2]();
|
||||
});
|
||||
}
|
||||
|
||||
function isTypeSync(fsStatType, statsMethodName, filePath) {
|
||||
if (typeof filePath !== 'string') {
|
||||
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
||||
function typeSync(fn, fn2, fp) {
|
||||
if (typeof fp !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
try {
|
||||
return fs[fsStatType](filePath)[statsMethodName]();
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
return false;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
return fs[fn](fp)[fn2]();
|
||||
}
|
||||
|
||||
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');
|
||||
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');
|
||||
|
||||
20
node_modules/path-type/license
generated
vendored
20
node_modules/path-type/license
generated
vendored
@@ -1,9 +1,21 @@
|
||||
MIT License
|
||||
The MIT License (MIT)
|
||||
|
||||
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,45 +1,52 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
58
node_modules/path-type/readme.md
generated
vendored
58
node_modules/path-type/readme.md
generated
vendored
@@ -6,67 +6,37 @@
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install path-type
|
||||
$ npm install --save path-type
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const {isFile} = require('path-type');
|
||||
var pathType = require('path-type');
|
||||
|
||||
(async () => {
|
||||
console.log(await isFile('package.json'));
|
||||
pathType.file('package.json').then(function (isFile) {
|
||||
console.log(isFile);
|
||||
//=> true
|
||||
})();
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### isFile(path)
|
||||
### .file(path)
|
||||
### .dir(path)
|
||||
### .symlink(path)
|
||||
|
||||
Check whether the passed `path` is a file.
|
||||
Returns a promise that resolves to a boolean of whether the path is the checked type.
|
||||
|
||||
Returns a `Promise<boolean>`.
|
||||
### .fileSync(path)
|
||||
### .dirSync(path)
|
||||
### .symlinkSync(path)
|
||||
|
||||
#### 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`.
|
||||
Returns a boolean of whether the path is the checked type.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
|
||||
Reference in New Issue
Block a user