diff options
author | Yuchen Pei <hi@ypei.me> | 2022-07-28 15:32:10 +1000 |
---|---|---|
committer | Yuchen Pei <hi@ypei.me> | 2022-07-28 15:32:10 +1000 |
commit | 5b10a10743b8459f64fe83e0ff420f69da79c9a4 (patch) | |
tree | c61904d688247790181d4955a4074b8c94302c03 /utilities/hash_script/node_modules/is-stream | |
parent | b98cb70b1bcd5b211aaa5d2675f96416911c0647 (diff) |
Moving scripts and utilities into a new utilities dir
Diffstat (limited to 'utilities/hash_script/node_modules/is-stream')
4 files changed, 190 insertions, 0 deletions
diff --git a/utilities/hash_script/node_modules/is-stream/index.js b/utilities/hash_script/node_modules/is-stream/index.js new file mode 100644 index 0000000..6f7ec91 --- /dev/null +++ b/utilities/hash_script/node_modules/is-stream/index.js @@ -0,0 +1,21 @@ +'use strict'; + +var isStream = module.exports = function (stream) { + return stream !== null && typeof stream === 'object' && typeof stream.pipe === 'function'; +}; + +isStream.writable = function (stream) { + return isStream(stream) && stream.writable !== false && typeof stream._write === 'function' && typeof stream._writableState === 'object'; +}; + +isStream.readable = function (stream) { + return isStream(stream) && stream.readable !== false && typeof stream._read === 'function' && typeof stream._readableState === 'object'; +}; + +isStream.duplex = function (stream) { + return isStream.writable(stream) && isStream.readable(stream); +}; + +isStream.transform = function (stream) { + return isStream.duplex(stream) && typeof stream._transform === 'function' && typeof stream._transformState === 'object'; +}; diff --git a/utilities/hash_script/node_modules/is-stream/license b/utilities/hash_script/node_modules/is-stream/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/utilities/hash_script/node_modules/is-stream/license @@ -0,0 +1,21 @@ +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/utilities/hash_script/node_modules/is-stream/package.json b/utilities/hash_script/node_modules/is-stream/package.json new file mode 100644 index 0000000..d3b4211 --- /dev/null +++ b/utilities/hash_script/node_modules/is-stream/package.json @@ -0,0 +1,106 @@ +{ + "_args": [ + [ + { + "raw": "is-stream@^1.0.1", + "scope": null, + "escapedName": "is-stream", + "name": "is-stream", + "rawSpec": "^1.0.1", + "spec": ">=1.0.1 <2.0.0", + "type": "range" + }, + "/home/nate/Desktop/tar_JDkx6AzcE/node_modules/node-fetch" + ] + ], + "_from": "is-stream@>=1.0.1 <2.0.0", + "_id": "is-stream@1.1.0", + "_inCache": true, + "_location": "/is-stream", + "_nodeVersion": "4.4.2", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/is-stream-1.1.0.tgz_1460446915184_0.806101513793692" + }, + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "_npmVersion": "2.15.0", + "_phantomChildren": {}, + "_requested": { + "raw": "is-stream@^1.0.1", + "scope": null, + "escapedName": "is-stream", + "name": "is-stream", + "rawSpec": "^1.0.1", + "spec": ">=1.0.1 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/node-fetch" + ], + "_resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "_shasum": "12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44", + "_shrinkwrap": null, + "_spec": "is-stream@^1.0.1", + "_where": "/home/nate/Desktop/tar_JDkx6AzcE/node_modules/node-fetch", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/is-stream/issues" + }, + "dependencies": {}, + "description": "Check if something is a Node.js stream", + "devDependencies": { + "ava": "*", + "tempfile": "^1.1.0", + "xo": "*" + }, + "directories": {}, + "dist": { + "shasum": "12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44", + "tarball": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "gitHead": "e21d73f1028c189d16150cea52641059b0936310", + "homepage": "https://github.com/sindresorhus/is-stream#readme", + "keywords": [ + "stream", + "type", + "streams", + "writable", + "readable", + "duplex", + "transform", + "check", + "detect", + "is" + ], + "license": "MIT", + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "name": "is-stream", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/is-stream.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "1.1.0" +} diff --git a/utilities/hash_script/node_modules/is-stream/readme.md b/utilities/hash_script/node_modules/is-stream/readme.md new file mode 100644 index 0000000..d8afce8 --- /dev/null +++ b/utilities/hash_script/node_modules/is-stream/readme.md @@ -0,0 +1,42 @@ +# is-stream [![Build Status](https://travis-ci.org/sindresorhus/is-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/is-stream) + +> Check if something is a [Node.js stream](https://nodejs.org/api/stream.html) + + +## Install + +``` +$ npm install --save is-stream +``` + + +## Usage + +```js +const fs = require('fs'); +const isStream = require('is-stream'); + +isStream(fs.createReadStream('unicorn.png')); +//=> true + +isStream({}); +//=> false +``` + + +## API + +### isStream(stream) + +#### isStream.writable(stream) + +#### isStream.readable(stream) + +#### isStream.duplex(stream) + +#### isStream.transform(stream) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) |