diff options
author | Minteck <contact@minteck.org> | 2022-06-04 08:51:19 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-06-04 08:51:19 +0200 |
commit | b22f6770c8bd084d66950655203c61dd701b3d90 (patch) | |
tree | 873d7fb19584ec2709b95cc1ca05a1fc7cfd0fc4 /node_modules/@szmarczak/http-timer | |
parent | 383285ecd5292bf9a825e05904955b937de84cc9 (diff) | |
download | equestriadb-b22f6770c8bd084d66950655203c61dd701b3d90.tar.gz equestriadb-b22f6770c8bd084d66950655203c61dd701b3d90.tar.bz2 equestriadb-b22f6770c8bd084d66950655203c61dd701b3d90.zip |
Remove node_modules
Diffstat (limited to 'node_modules/@szmarczak/http-timer')
-rwxr-xr-x | node_modules/@szmarczak/http-timer/LICENSE | 21 | ||||
-rwxr-xr-x | node_modules/@szmarczak/http-timer/README.md | 70 | ||||
-rwxr-xr-x | node_modules/@szmarczak/http-timer/package.json | 47 | ||||
-rwxr-xr-x | node_modules/@szmarczak/http-timer/source/index.js | 99 |
4 files changed, 0 insertions, 237 deletions
diff --git a/node_modules/@szmarczak/http-timer/LICENSE b/node_modules/@szmarczak/http-timer/LICENSE deleted file mode 100755 index 15ad2e8..0000000 --- a/node_modules/@szmarczak/http-timer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 Szymon Marczak - -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/@szmarczak/http-timer/README.md b/node_modules/@szmarczak/http-timer/README.md deleted file mode 100755 index 13279ed..0000000 --- a/node_modules/@szmarczak/http-timer/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# http-timer -> Timings for HTTP requests - -[![Build Status](https://travis-ci.org/szmarczak/http-timer.svg?branch=master)](https://travis-ci.org/szmarczak/http-timer) -[![Coverage Status](https://coveralls.io/repos/github/szmarczak/http-timer/badge.svg?branch=master)](https://coveralls.io/github/szmarczak/http-timer?branch=master) -[![install size](https://packagephobia.now.sh/badge?p=@szmarczak/http-timer)](https://packagephobia.now.sh/result?p=@szmarczak/http-timer) - -Inspired by the [`request` package](https://github.com/request/request). - -## Usage -```js -'use strict'; -const https = require('https'); -const timer = require('@szmarczak/http-timer'); - -const request = https.get('https://httpbin.org/anything'); -const timings = timer(request); - -request.on('response', response => { - response.on('data', () => {}); // Consume the data somehow - response.on('end', () => { - console.log(timings); - }); -}); - -// { start: 1535708511443, -// socket: 1535708511444, -// lookup: 1535708511444, -// connect: 1535708511582, -// upload: 1535708511887, -// response: 1535708512037, -// end: 1535708512040, -// phases: -// { wait: 1, -// dns: 0, -// tcp: 138, -// request: 305, -// firstByte: 150, -// download: 3, -// total: 597 } } -``` - -## API - -### timer(request) - -Returns: `Object` - -- `start` - Time when the request started. -- `socket` - Time when a socket was assigned to the request. -- `lookup` - Time when the DNS lookup finished. -- `connect` - Time when the socket successfully connected. -- `upload` - Time when the request finished uploading. -- `response` - Time when the request fired the `response` event. -- `end` - Time when the response fired the `end` event. -- `error` - Time when the request fired the `error` event. -- `phases` - - `wait` - `timings.socket - timings.start` - - `dns` - `timings.lookup - timings.socket` - - `tcp` - `timings.connect - timings.lookup` - - `request` - `timings.upload - timings.connect` - - `firstByte` - `timings.response - timings.upload` - - `download` - `timings.end - timings.response` - - `total` - `timings.end - timings.start` or `timings.error - timings.start` - -**Note**: The time is a `number` representing the milliseconds elapsed since the UNIX epoch. - -## License - -MIT diff --git a/node_modules/@szmarczak/http-timer/package.json b/node_modules/@szmarczak/http-timer/package.json deleted file mode 100755 index 9346648..0000000 --- a/node_modules/@szmarczak/http-timer/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "@szmarczak/http-timer", - "version": "1.1.2", - "description": "Timings for HTTP requests", - "main": "source", - "engines": { - "node": ">=6" - }, - "scripts": { - "test": "xo && nyc ava", - "coveralls": "nyc report --reporter=text-lcov | coveralls" - }, - "files": [ - "source" - ], - "keywords": [ - "http", - "https", - "timer", - "timings" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/szmarczak/http-timer.git" - }, - "author": "Szymon Marczak", - "license": "MIT", - "bugs": { - "url": "https://github.com/szmarczak/http-timer/issues" - }, - "homepage": "https://github.com/szmarczak/http-timer#readme", - "xo": { - "rules": { - "unicorn/filename-case": "camelCase" - } - }, - "devDependencies": { - "ava": "^0.25.0", - "coveralls": "^3.0.2", - "p-event": "^2.1.0", - "nyc": "^12.0.2", - "xo": "^0.22.0" - }, - "dependencies": { - "defer-to-connect": "^1.0.1" - } -} diff --git a/node_modules/@szmarczak/http-timer/source/index.js b/node_modules/@szmarczak/http-timer/source/index.js deleted file mode 100755 index e294580..0000000 --- a/node_modules/@szmarczak/http-timer/source/index.js +++ /dev/null @@ -1,99 +0,0 @@ -'use strict'; -const deferToConnect = require('defer-to-connect'); - -module.exports = request => { - const timings = { - start: Date.now(), - socket: null, - lookup: null, - connect: null, - upload: null, - response: null, - end: null, - error: null, - phases: { - wait: null, - dns: null, - tcp: null, - request: null, - firstByte: null, - download: null, - total: null - } - }; - - const handleError = origin => { - const emit = origin.emit.bind(origin); - origin.emit = (event, ...args) => { - // Catches the `error` event - if (event === 'error') { - timings.error = Date.now(); - timings.phases.total = timings.error - timings.start; - - origin.emit = emit; - } - - // Saves the original behavior - return emit(event, ...args); - }; - }; - - let uploadFinished = false; - const onUpload = () => { - timings.upload = Date.now(); - timings.phases.request = timings.upload - timings.connect; - }; - - handleError(request); - - request.once('socket', socket => { - timings.socket = Date.now(); - timings.phases.wait = timings.socket - timings.start; - - const lookupListener = () => { - timings.lookup = Date.now(); - timings.phases.dns = timings.lookup - timings.socket; - }; - - socket.once('lookup', lookupListener); - - deferToConnect(socket, () => { - timings.connect = Date.now(); - - if (timings.lookup === null) { - socket.removeListener('lookup', lookupListener); - timings.lookup = timings.connect; - timings.phases.dns = timings.lookup - timings.socket; - } - - timings.phases.tcp = timings.connect - timings.lookup; - - if (uploadFinished && !timings.upload) { - onUpload(); - } - }); - }); - - request.once('finish', () => { - uploadFinished = true; - - if (timings.connect) { - onUpload(); - } - }); - - request.once('response', response => { - timings.response = Date.now(); - timings.phases.firstByte = timings.response - timings.upload; - - handleError(response); - - response.once('end', () => { - timings.end = Date.now(); - timings.phases.download = timings.end - timings.response; - timings.phases.total = timings.end - timings.start; - }); - }); - - return timings; -}; |