diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:10:59 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:41:44 +0800 |
| commit | fc87c009806dcc98867f6b58efe29b042aa01dee (patch) | |
| tree | 8f59b3f4a5b66e9dfef2d40c8d318e258a521228 /node_modules/read-cache | |
| parent | 3336b2356ee6152d9c6ae59bd9b87ccbc0958407 (diff) | |
node: updatemain
Diffstat (limited to 'node_modules/read-cache')
| -rw-r--r-- | node_modules/read-cache/LICENSE | 20 | ||||
| -rw-r--r-- | node_modules/read-cache/README.md | 46 | ||||
| -rw-r--r-- | node_modules/read-cache/index.js | 78 | ||||
| -rw-r--r-- | node_modules/read-cache/node_modules/pify/index.js | 68 | ||||
| -rw-r--r-- | node_modules/read-cache/node_modules/pify/license | 21 | ||||
| -rw-r--r-- | node_modules/read-cache/node_modules/pify/package.json | 48 | ||||
| -rw-r--r-- | node_modules/read-cache/node_modules/pify/readme.md | 119 | ||||
| -rw-r--r-- | node_modules/read-cache/package.json | 34 |
8 files changed, 0 insertions, 434 deletions
diff --git a/node_modules/read-cache/LICENSE b/node_modules/read-cache/LICENSE deleted file mode 100644 index 4b98a41f..00000000 --- a/node_modules/read-cache/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright 2016 Bogdan Chadkin <trysound@yandex.ru> - -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 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. diff --git a/node_modules/read-cache/README.md b/node_modules/read-cache/README.md deleted file mode 100644 index 16a5c36e..00000000 --- a/node_modules/read-cache/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# read-cache [](https://travis-ci.org/TrySound/read-cache)
-
-Reads and caches the entire contents of a file until it is modified.
-
-
-## Install
-
-```
-$ npm i read-cache
-```
-
-
-## Usage
-
-```js
-// foo.js
-var readCache = require('read-cache');
-
-readCache('foo.js').then(function (contents) {
- console.log(contents);
-});
-```
-
-
-## API
-
-### readCache(path[, encoding])
-
-Returns a promise that resolves with the file's contents.
-
-### readCache.sync(path[, encoding])
-
-Returns the content of the file.
-
-### readCache.get(path[, encoding])
-
-Returns the content of cached file or null.
-
-### readCache.clear()
-
-Clears the contents of the cache.
-
-
-## License
-
-MIT © [Bogdan Chadkin](mailto:trysound@yandex.ru)
diff --git a/node_modules/read-cache/index.js b/node_modules/read-cache/index.js deleted file mode 100644 index b5263e68..00000000 --- a/node_modules/read-cache/index.js +++ /dev/null @@ -1,78 +0,0 @@ -var fs = require('fs');
-var path = require('path');
-var pify = require('pify');
-
-var stat = pify(fs.stat);
-var readFile = pify(fs.readFile);
-var resolve = path.resolve;
-
-var cache = Object.create(null);
-
-function convert(content, encoding) {
- if (Buffer.isEncoding(encoding)) {
- return content.toString(encoding);
- }
- return content;
-}
-
-module.exports = function (path, encoding) {
- path = resolve(path);
-
- return stat(path).then(function (stats) {
- var item = cache[path];
-
- if (item && item.mtime.getTime() === stats.mtime.getTime()) {
- return convert(item.content, encoding);
- }
-
- return readFile(path).then(function (data) {
- cache[path] = {
- mtime: stats.mtime,
- content: data
- };
-
- return convert(data, encoding);
- });
- }).catch(function (err) {
- cache[path] = null;
- return Promise.reject(err);
- });
-};
-
-module.exports.sync = function (path, encoding) {
- path = resolve(path);
-
- try {
- var stats = fs.statSync(path);
- var item = cache[path];
-
- if (item && item.mtime.getTime() === stats.mtime.getTime()) {
- return convert(item.content, encoding);
- }
-
- var data = fs.readFileSync(path);
-
- cache[path] = {
- mtime: stats.mtime,
- content: data
- };
-
- return convert(data, encoding);
- } catch (err) {
- cache[path] = null;
- throw err;
- }
-
-};
-
-module.exports.get = function (path, encoding) {
- path = resolve(path);
- if (cache[path]) {
- return convert(cache[path].content, encoding);
- }
- return null;
-};
-
-module.exports.clear = function () {
- cache = Object.create(null);
-};
diff --git a/node_modules/read-cache/node_modules/pify/index.js b/node_modules/read-cache/node_modules/pify/index.js deleted file mode 100644 index 7c720ebe..00000000 --- a/node_modules/read-cache/node_modules/pify/index.js +++ /dev/null @@ -1,68 +0,0 @@ -'use strict'; - -var processFn = function (fn, P, opts) { - return function () { - var that = this; - var args = new Array(arguments.length); - - for (var i = 0; i < arguments.length; i++) { - args[i] = arguments[i]; - } - - return new P(function (resolve, reject) { - args.push(function (err, result) { - if (err) { - reject(err); - } else if (opts.multiArgs) { - var results = new Array(arguments.length - 1); - - for (var i = 1; i < arguments.length; i++) { - results[i - 1] = arguments[i]; - } - - resolve(results); - } else { - resolve(result); - } - }); - - fn.apply(that, args); - }); - }; -}; - -var pify = module.exports = function (obj, P, opts) { - if (typeof P !== 'function') { - opts = P; - P = Promise; - } - - opts = opts || {}; - opts.exclude = opts.exclude || [/.+Sync$/]; - - var filter = function (key) { - var match = function (pattern) { - return typeof pattern === 'string' ? key === pattern : pattern.test(key); - }; - - return opts.include ? opts.include.some(match) : !opts.exclude.some(match); - }; - - var ret = typeof obj === 'function' ? function () { - if (opts.excludeMain) { - return obj.apply(this, arguments); - } - - return processFn(obj, P, opts).apply(this, arguments); - } : {}; - - return Object.keys(obj).reduce(function (ret, key) { - var x = obj[key]; - - ret[key] = typeof x === 'function' && filter(key) ? processFn(x, P, opts) : x; - - return ret; - }, ret); -}; - -pify.all = pify; diff --git a/node_modules/read-cache/node_modules/pify/license b/node_modules/read-cache/node_modules/pify/license deleted file mode 100644 index 654d0bfe..00000000 --- a/node_modules/read-cache/node_modules/pify/license +++ /dev/null @@ -1,21 +0,0 @@ -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: - -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. diff --git a/node_modules/read-cache/node_modules/pify/package.json b/node_modules/read-cache/node_modules/pify/package.json deleted file mode 100644 index 311d1982..00000000 --- a/node_modules/read-cache/node_modules/pify/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "pify", - "version": "2.3.0", - "description": "Promisify a callback-style function", - "license": "MIT", - "repository": "sindresorhus/pify", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "xo && ava && npm run optimization-test", - "optimization-test": "node --allow-natives-syntax optimization-test.js" - }, - "files": [ - "index.js" - ], - "keywords": [ - "promise", - "promises", - "promisify", - "denodify", - "denodeify", - "callback", - "cb", - "node", - "then", - "thenify", - "convert", - "transform", - "wrap", - "wrapper", - "bind", - "to", - "async", - "es2015" - ], - "devDependencies": { - "ava": "*", - "pinkie-promise": "^1.0.0", - "v8-natives": "0.0.2", - "xo": "*" - } -} diff --git a/node_modules/read-cache/node_modules/pify/readme.md b/node_modules/read-cache/node_modules/pify/readme.md deleted file mode 100644 index c79ca8bf..00000000 --- a/node_modules/read-cache/node_modules/pify/readme.md +++ /dev/null @@ -1,119 +0,0 @@ -# pify [](https://travis-ci.org/sindresorhus/pify) - -> Promisify a callback-style function - - -## Install - -``` -$ npm install --save pify -``` - - -## Usage - -```js -const fs = require('fs'); -const pify = require('pify'); - -// promisify a single function - -pify(fs.readFile)('package.json', 'utf8').then(data => { - console.log(JSON.parse(data).name); - //=> 'pify' -}); - -// or promisify all methods in a module - -pify(fs).readFile('package.json', 'utf8').then(data => { - console.log(JSON.parse(data).name); - //=> 'pify' -}); -``` - - -## API - -### pify(input, [promiseModule], [options]) - -Returns a promise wrapped version of the supplied function or module. - -#### input - -Type: `function`, `object` - -Callback-style function or module whose methods you want to promisify. - -#### promiseModule - -Type: `function` - -Custom promise module to use instead of the native one. - -Check out [`pinkie-promise`](https://github.com/floatdrop/pinkie-promise) if you need a tiny promise polyfill. - -#### options - -##### multiArgs - -Type: `boolean` -Default: `false` - -By default, the promisified function will only return the second argument from the callback, which works fine for most APIs. This option can be useful for modules like `request` that return multiple arguments. Turning this on will make it return an array of all arguments from the callback, excluding the error argument, instead of just the second argument. - -```js -const request = require('request'); -const pify = require('pify'); - -pify(request, {multiArgs: true})('https://sindresorhus.com').then(result => { - const [httpResponse, body] = result; -}); -``` - -##### include - -Type: `array` of (`string`|`regex`) - -Methods in a module to promisify. Remaining methods will be left untouched. - -##### exclude - -Type: `array` of (`string`|`regex`) -Default: `[/.+Sync$/]` - -Methods in a module **not** to promisify. Methods with names ending with `'Sync'` are excluded by default. - -##### excludeMain - -Type: `boolean` -Default: `false` - -By default, if given module is a function itself, this function will be promisified. Turn this option on if you want to promisify only methods of the module. - -```js -const pify = require('pify'); - -function fn() { - return true; -} - -fn.method = (data, callback) => { - setImmediate(() => { - callback(data, null); - }); -}; - -// promisify methods but not fn() -const promiseFn = pify(fn, {excludeMain: true}); - -if (promiseFn()) { - promiseFn.method('hi').then(data => { - console.log(data); - }); -} -``` - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/read-cache/package.json b/node_modules/read-cache/package.json deleted file mode 100644 index 87199b0e..00000000 --- a/node_modules/read-cache/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "read-cache", - "version": "1.0.0", - "description": "Reads and caches the entire contents of a file until it is modified", - "files": [ - "index.js" - ], - "main": "index.js", - "scripts": { - "test": "ava" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/TrySound/read-cache.git" - }, - "keywords": [ - "fs", - "read", - "cache" - ], - "author": "Bogdan Chadkin <trysound@yandex.ru>", - "license": "MIT", - "bugs": { - "url": "https://github.com/TrySound/read-cache/issues" - }, - "homepage": "https://github.com/TrySound/read-cache#readme", - "devDependencies": { - "ava": "^0.9.1", - "del": "^2.2.0" - }, - "dependencies": { - "pify": "^2.3.0" - } -} |
