yeet
This commit is contained in:
21
node_modules/phin/LICENSE
generated
vendored
Normal file
21
node_modules/phin/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Ethan Davis
|
||||
|
||||
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.
|
102
node_modules/phin/README.md
generated
vendored
Normal file
102
node_modules/phin/README.md
generated
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
<p align="center" style="text-align: center"><img src="https://raw.githubusercontent.com/ethanent/phin/master/media/phin-textIncluded.png" width="250" alt="phin logo"/></p>
|
||||
|
||||
---
|
||||
|
||||
> The ultra-lightweight Node.js HTTP client
|
||||
|
||||
[Full documentation](https://ethanent.github.io/phin/) | [GitHub](https://github.com/ethanent/phin) | [NPM](https://www.npmjs.com/package/phin)
|
||||
|
||||
|
||||
## Simple Usage
|
||||
|
||||
```javascript
|
||||
const p = require('phin')
|
||||
|
||||
p('https://ethanent.me', (err, res) => {
|
||||
if (!err) console.log(res.body)
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm install phin
|
||||
```
|
||||
|
||||
|
||||
## Why phin?
|
||||
|
||||
phin is **trusted** by some really important projects. The hundreds of contributors at [Less](https://github.com/less/less.js), for example, depend on phin as part of their development process.
|
||||
|
||||
Also, phin is super **lightweight**. Like **99.8% smaller than request** lightweight. To compare to other libraries, see [phin vs. the Competition](https://github.com/ethanent/phin/blob/master/README.md#phin-vs-the-competition).
|
||||
|
||||
<img src="https://pbs.twimg.com/media/DSPF9TaUQAA0tIe.jpg:large" alt="phin became 33% lighter with release 2.7.0!"/>
|
||||
|
||||
|
||||
## Quick Demos
|
||||
|
||||
Simple POST:
|
||||
|
||||
```javascript
|
||||
p({
|
||||
url: 'https://ethanent.me',
|
||||
method: 'POST',
|
||||
data: {
|
||||
hey: 'hi'
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
Promisified:
|
||||
|
||||
```javascript
|
||||
const p = require('phin').promisified
|
||||
```
|
||||
|
||||
```javascript
|
||||
;(async () => {
|
||||
const res = await p({
|
||||
url: 'https://ethanent.me'
|
||||
})
|
||||
|
||||
console.log(res.body)
|
||||
})()
|
||||
```
|
||||
|
||||
Simple parsing of JSON:
|
||||
|
||||
```javascript
|
||||
// (In async function in this case.)
|
||||
|
||||
const res = await p({
|
||||
url: 'https://ethanent.me/name',
|
||||
parse: 'json'
|
||||
})
|
||||
|
||||
console.log(res.body.first)
|
||||
```
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
See [the phin documentation](https://ethanent.github.io/phin/).
|
||||
|
||||
`phin` has [`util.promisify`](https://nodejs.org/dist/latest-v8.x/docs/api/util.html#util_util_promisify_original) support. The promisified library can also be accessed with `require('phin').promisified`!
|
||||
|
||||
|
||||
## phin vs. the Competition
|
||||
|
||||
<img src="https://pbs.twimg.com/media/DSLU_UcUEAI4bgc.jpg:large" alt="Request is over 6MB in size. phin is just 25KB in size."/>
|
||||
|
||||
phin is super lightweight, and *it's getting lighter all the time*.
|
||||
|
||||
It contains all of the common HTTP client features included in competing libraries!
|
||||
|
||||
Package | Size (KB) | Dependencies<br />(Tree Count) | Size Comparison<br />(vs. phin)
|
||||
--- | --- | --- | ---
|
||||
request | 4,446 | [53](http://npm.anvaka.com/#/view/2d/request) | 444.6x
|
||||
superagent | 1,235 | [24](http://npm.anvaka.com/#/view/2d/superagent) | 123.5x
|
||||
got | 664 | [44](http://npm.anvaka.com/#/view/2d/got) | 66.4x
|
||||
snekfetch | 107 | [0](http://npm.anvaka.com/#/view/2d/snekfetch) | 10.7x
|
||||
phin | 10 | [0](http://npm.anvaka.com/#/view/2d/phin) | 1x
|
1
node_modules/phin/lib/phin.compiled.js
generated
vendored
Normal file
1
node_modules/phin/lib/phin.compiled.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
'use strict';var _typeof=typeof Symbol==='function'&&typeof Symbol.iterator==='symbol'?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==='function'&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj};var http=require('http');var https=require('https');var url=require('url');var qs=require('querystring');var zlib=require('zlib');var util=require('util');var phin=function phin(opts,cb){if(typeof opts!=='string'){if(!opts.hasOwnProperty('url')){throw new Error('Missing url option from options for request method.')}}var addr=(typeof opts==='undefined'?'undefined':_typeof(opts))==='object'?url.parse(opts.url):url.parse(opts);var options={'hostname':addr.hostname,'port':addr.port||(addr.protocol.toLowerCase()==='http:'?80:443),'path':addr.path,'method':'GET','headers':{},'auth':addr.auth||null,'parse':'none','stream':false};if((typeof opts==='undefined'?'undefined':_typeof(opts))==='object'){options=Object.assign(options,opts)}options.port=Number(options.port);if(options.hasOwnProperty('timeout'))delete options.timeout;if(options.compressed===true){options.headers['accept-encoding']='gzip, deflate'}if(opts.hasOwnProperty('form')){if(_typeof(opts.form)!=='object'){throw new Error('phin \'form\' option must be of type Object if present.')}var formDataString=qs.stringify(opts.form);options.headers['Content-Type']='application/x-www-form-urlencoded';options.headers['Content-Length']=Buffer.byteLength(formDataString);opts.data=formDataString}var req=void 0;var resHandler=function resHandler(res){var stream=res;if(options.compressed===true){if(res.headers['content-encoding']==='gzip'){stream=res.pipe(zlib.createGunzip())}else if(res.headers['content-encoding']==='deflate'){stream=res.pipe(zlib.createInflate())}}if(options.stream===true){res.stream=stream;if(cb)cb(null,res)}else{res.body=new Buffer([]);stream.on('data',function(chunk){res.body=Buffer.concat([res.body,chunk])});stream.on('end',function(){if(cb){if(options.parse==='json'){try{res.body=JSON.parse(res.body.toString())}catch(err){cb('Invalid JSON received.',res);return}}cb(null,res)}})}};switch(addr.protocol.toLowerCase()){case'http:':req=http.request(options,resHandler);break;case'https:':req=https.request(options,resHandler);break;default:if(cb)cb(new Error('Invalid / unknown URL protocol. Expected HTTP or HTTPS.'),null);return;}if(typeof opts.timeout==='number'){req.setTimeout(opts.timeout,function(){req.abort();if(cb)cb(new Error('Timeout has been reached.'),null);cb=null})}req.on('error',function(err){if(cb)cb(err,null)});if(opts.hasOwnProperty('data')){var postData=opts.data;if(!(opts.data instanceof Buffer)&&_typeof(opts.data)==='object'){var contentType=options.headers['content-type']||options.headers['Content-Type'];if(contentType==='application/x-www-form-urlencoded'){postData=qs.stringify(opts.data)}else{try{postData=JSON.stringify(opts.data)}catch(err){if(cb)cb(new Error('Couldn\'t stringify object. (Likely due to a circular reference.)'),null)}}}req.write(postData)}req.end()};phin.promisified=function(opts,http){return new Promise(function(resolve,reject){phin(opts,function(err,res){if(err){reject(err)}else{resolve(res)}},http)})};if(util.promisify){phin[util.promisify.custom]=phin.promisified}module.exports=phin;
|
41
node_modules/phin/package.json
generated
vendored
Normal file
41
node_modules/phin/package.json
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "phin",
|
||||
"version": "2.9.3",
|
||||
"description": "Ultra-simple, lightweight, dependency-free Node.JS HTTP request client",
|
||||
"main": "lib/phin.compiled.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Tested before deployment.\" && exit 0",
|
||||
"test-dev": "node ./tests/test.js",
|
||||
"prepublishOnly": "npm run test-dev",
|
||||
"gendocs": "rm -r docs || true && jsdoc -R README.md -d ./docs lib/phin.js",
|
||||
"build": "npx babel lib/phin.js --out-file lib/phin.compiled.js --presets env --minified --no-comments"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ethanent/phin.git"
|
||||
},
|
||||
"keywords": [
|
||||
"http",
|
||||
"https",
|
||||
"request",
|
||||
"fetch",
|
||||
"ajax",
|
||||
"url",
|
||||
"uri"
|
||||
],
|
||||
"author": "Ethan Davis",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ethanent/phin/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ethanent/phin#readme",
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-preset-env": "^1.6.1",
|
||||
"whew": "^1.0.0"
|
||||
},
|
||||
"files": [
|
||||
"lib/phin.compiled.js",
|
||||
"LICENSE"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user