twitst4tz

twitter statistics web application
Log | Files | Refs | README | LICENSE

package.json (22781B)


      1 {
      2   "_from": "node-fetch",
      3   "_id": "node-fetch@2.6.0",
      4   "_inBundle": false,
      5   "_integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==",
      6   "_location": "/node-fetch",
      7   "_phantomChildren": {},
      8   "_requested": {
      9     "escapedName": "node-fetch",
     10     "fetchSpec": "latest",
     11     "name": "node-fetch",
     12     "raw": "node-fetch",
     13     "rawSpec": "",
     14     "registry": true,
     15     "saveSpec": null,
     16     "type": "tag"
     17   },
     18   "_requiredBy": [
     19     "#USER",
     20     "/"
     21   ],
     22   "_resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
     23   "_shasum": "e633456386d4aa55863f676a7ab0daa8fdecb0fd",
     24   "_shrinkwrap": null,
     25   "_spec": "node-fetch",
     26   "_where": "/Users/underd0g/Documents/javascript/TwitWebGraph",
     27   "author": {
     28     "name": "David Frank"
     29   },
     30   "browser": "./browser.js",
     31   "bugs": {
     32     "url": "https://github.com/bitinn/node-fetch/issues"
     33   },
     34   "bundleDependencies": false,
     35   "dependencies": {},
     36   "deprecated": false,
     37   "description": "A light-weight module that brings window.fetch to node.js",
     38   "devDependencies": {
     39     "@ungap/url-search-params": "^0.1.2",
     40     "abort-controller": "^1.1.0",
     41     "abortcontroller-polyfill": "^1.3.0",
     42     "babel-core": "^6.26.3",
     43     "babel-plugin-istanbul": "^4.1.6",
     44     "babel-preset-env": "^1.6.1",
     45     "babel-register": "^6.16.3",
     46     "chai": "^3.5.0",
     47     "chai-as-promised": "^7.1.1",
     48     "chai-iterator": "^1.1.1",
     49     "chai-string": "~1.3.0",
     50     "codecov": "^3.3.0",
     51     "cross-env": "^5.2.0",
     52     "form-data": "^2.3.3",
     53     "is-builtin-module": "^1.0.0",
     54     "mocha": "^5.0.0",
     55     "nyc": "11.9.0",
     56     "parted": "^0.1.1",
     57     "promise": "^8.0.3",
     58     "resumer": "0.0.0",
     59     "rollup": "^0.63.4",
     60     "rollup-plugin-babel": "^3.0.7",
     61     "string-to-arraybuffer": "^1.0.2",
     62     "whatwg-url": "^5.0.0"
     63   },
     64   "engines": {
     65     "node": "4.x || >=6.0.0"
     66   },
     67   "files": [
     68     "browser.js",
     69     "lib/index.es.js",
     70     "lib/index.js",
     71     "lib/index.mjs"
     72   ],
     73   "homepage": "https://github.com/bitinn/node-fetch",
     74   "keywords": [
     75     "fetch",
     76     "http",
     77     "promise"
     78   ],
     79   "license": "MIT",
     80   "main": "lib/index",
     81   "module": "lib/index.mjs",
     82   "name": "node-fetch",
     83   "optionalDependencies": {},
     84   "readme": "node-fetch\n==========\n\n[![npm version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![coverage status][codecov-image]][codecov-url]\n[![install size][install-size-image]][install-size-url]\n\nA light-weight module that brings `window.fetch` to Node.js\n\n(We are looking for [v2 maintainers and collaborators](https://github.com/bitinn/node-fetch/issues/567))\n\n<!-- TOC -->\n\n- [Motivation](#motivation)\n- [Features](#features)\n- [Difference from client-side fetch](#difference-from-client-side-fetch)\n- [Installation](#installation)\n- [Loading and configuring the module](#loading-and-configuring-the-module)\n- [Common Usage](#common-usage)\n    - [Plain text or HTML](#plain-text-or-html)\n    - [JSON](#json)\n    - [Simple Post](#simple-post)\n    - [Post with JSON](#post-with-json)\n    - [Post with form parameters](#post-with-form-parameters)\n    - [Handling exceptions](#handling-exceptions)\n    - [Handling client and server errors](#handling-client-and-server-errors)\n- [Advanced Usage](#advanced-usage)\n    - [Streams](#streams)\n    - [Buffer](#buffer)\n    - [Accessing Headers and other Meta data](#accessing-headers-and-other-meta-data)\n    - [Extract Set-Cookie Header](#extract-set-cookie-header)\n    - [Post data using a file stream](#post-data-using-a-file-stream)\n    - [Post with form-data (detect multipart)](#post-with-form-data-detect-multipart)\n    - [Request cancellation with AbortSignal](#request-cancellation-with-abortsignal)\n- [API](#api)\n    - [fetch(url[, options])](#fetchurl-options)\n    - [Options](#options)\n    - [Class: Request](#class-request)\n    - [Class: Response](#class-response)\n    - [Class: Headers](#class-headers)\n    - [Interface: Body](#interface-body)\n    - [Class: FetchError](#class-fetcherror)\n- [License](#license)\n- [Acknowledgement](#acknowledgement)\n\n<!-- /TOC -->\n\n## Motivation\n\nInstead of implementing `XMLHttpRequest` in Node.js to run browser-specific [Fetch polyfill](https://github.com/github/fetch), why not go from native `http` to `fetch` API directly? Hence `node-fetch`, minimal code for a `window.fetch` compatible API on Node.js runtime.\n\nSee Matt Andrews' [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) or Leonardo Quixada's [cross-fetch](https://github.com/lquixada/cross-fetch) for isomorphic usage (exports `node-fetch` for server-side, `whatwg-fetch` for client-side).\n\n## Features\n\n- Stay consistent with `window.fetch` API.\n- Make conscious trade-off when following [WHATWG fetch spec][whatwg-fetch] and [stream spec](https://streams.spec.whatwg.org/) implementation details, document known differences.\n- Use native promise, but allow substituting it with [insert your favorite promise library].\n- Use native Node streams for body, on both request and response.\n- Decode content encoding (gzip/deflate) properly, and convert string output (such as `res.text()` and `res.json()`) to UTF-8 automatically.\n- Useful extensions such as timeout, redirect limit, response size limit, [explicit errors](ERROR-HANDLING.md) for troubleshooting.\n\n## Difference from client-side fetch\n\n- See [Known Differences](LIMITS.md) for details.\n- If you happen to use a missing feature that `window.fetch` offers, feel free to open an issue.\n- Pull requests are welcomed too!\n\n## Installation\n\nCurrent stable release (`2.x`)\n\n```sh\n$ npm install node-fetch --save\n```\n\n## Loading and configuring the module\nWe suggest you load the module via `require`, pending the stabalizing of es modules in node:\n```js\nconst fetch = require('node-fetch');\n```\n\nIf you are using a Promise library other than native, set it through fetch.Promise:\n```js\nconst Bluebird = require('bluebird');\n\nfetch.Promise = Bluebird;\n```\n\n## Common Usage\n\nNOTE: The documentation below is up-to-date with `2.x` releases, [see `1.x` readme](https://github.com/bitinn/node-fetch/blob/1.x/README.md), [changelog](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) and [2.x upgrade guide](UPGRADE-GUIDE.md) for the differences.\n\n#### Plain text or HTML\n```js\nfetch('https://github.com/')\n    .then(res => res.text())\n    .then(body => console.log(body));\n```\n\n#### JSON\n\n```js\n\nfetch('https://api.github.com/users/github')\n    .then(res => res.json())\n    .then(json => console.log(json));\n```\n\n#### Simple Post\n```js\nfetch('https://httpbin.org/post', { method: 'POST', body: 'a=1' })\n    .then(res => res.json()) // expecting a json response\n    .then(json => console.log(json));\n```\n\n#### Post with JSON\n\n```js\nconst body = { a: 1 };\n\nfetch('https://httpbin.org/post', {\n        method: 'post',\n        body:    JSON.stringify(body),\n        headers: { 'Content-Type': 'application/json' },\n    })\n    .then(res => res.json())\n    .then(json => console.log(json));\n```\n\n#### Post with form parameters\n`URLSearchParams` is available in Node.js as of v7.5.0. See [official documentation](https://nodejs.org/api/url.html#url_class_urlsearchparams) for more usage methods.\n\nNOTE: The `Content-Type` header is only set automatically to `x-www-form-urlencoded` when an instance of `URLSearchParams` is given as such:\n\n```js\nconst { URLSearchParams } = require('url');\n\nconst params = new URLSearchParams();\nparams.append('a', 1);\n\nfetch('https://httpbin.org/post', { method: 'POST', body: params })\n    .then(res => res.json())\n    .then(json => console.log(json));\n```\n\n#### Handling exceptions\nNOTE: 3xx-5xx responses are *NOT* exceptions, and should be handled in `then()`, see the next section.\n\nAdding a catch to the fetch promise chain will catch *all* exceptions, such as errors originating from node core libraries, like network errors, and operational errors which are instances of FetchError. See the [error handling document](ERROR-HANDLING.md)  for more details.\n\n```js\nfetch('https://domain.invalid/')\n    .catch(err => console.error(err));\n```\n\n#### Handling client and server errors\nIt is common to create a helper function to check that the response contains no client (4xx) or server (5xx) error responses:\n\n```js\nfunction checkStatus(res) {\n    if (res.ok) { // res.status >= 200 && res.status < 300\n        return res;\n    } else {\n        throw MyCustomError(res.statusText);\n    }\n}\n\nfetch('https://httpbin.org/status/400')\n    .then(checkStatus)\n    .then(res => console.log('will not get here...'))\n```\n\n## Advanced Usage\n\n#### Streams\nThe \"Node.js way\" is to use streams when possible:\n\n```js\nfetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png')\n    .then(res => {\n        const dest = fs.createWriteStream('./octocat.png');\n        res.body.pipe(dest);\n    });\n```\n\n#### Buffer\nIf you prefer to cache binary data in full, use buffer(). (NOTE: buffer() is a `node-fetch` only API)\n\n```js\nconst fileType = require('file-type');\n\nfetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png')\n    .then(res => res.buffer())\n    .then(buffer => fileType(buffer))\n    .then(type => { /* ... */ });\n```\n\n#### Accessing Headers and other Meta data\n```js\nfetch('https://github.com/')\n    .then(res => {\n        console.log(res.ok);\n        console.log(res.status);\n        console.log(res.statusText);\n        console.log(res.headers.raw());\n        console.log(res.headers.get('content-type'));\n    });\n```\n\n#### Extract Set-Cookie Header\n\nUnlike browsers, you can access raw `Set-Cookie` headers manually using `Headers.raw()`, this is a `node-fetch` only API.\n\n```js\nfetch(url).then(res => {\n    // returns an array of values, instead of a string of comma-separated values\n    console.log(res.headers.raw()['set-cookie']);\n});\n```\n\n#### Post data using a file stream\n\n```js\nconst { createReadStream } = require('fs');\n\nconst stream = createReadStream('input.txt');\n\nfetch('https://httpbin.org/post', { method: 'POST', body: stream })\n    .then(res => res.json())\n    .then(json => console.log(json));\n```\n\n#### Post with form-data (detect multipart)\n\n```js\nconst FormData = require('form-data');\n\nconst form = new FormData();\nform.append('a', 1);\n\nfetch('https://httpbin.org/post', { method: 'POST', body: form })\n    .then(res => res.json())\n    .then(json => console.log(json));\n\n// OR, using custom headers\n// NOTE: getHeaders() is non-standard API\n\nconst form = new FormData();\nform.append('a', 1);\n\nconst options = {\n    method: 'POST',\n    body: form,\n    headers: form.getHeaders()\n}\n\nfetch('https://httpbin.org/post', options)\n    .then(res => res.json())\n    .then(json => console.log(json));\n```\n\n#### Request cancellation with AbortSignal\n\n> NOTE: You may only cancel streamed requests on Node >= v8.0.0\n\nYou may cancel requests with `AbortController`. A suggested implementation is [`abort-controller`](https://www.npmjs.com/package/abort-controller).\n\nAn example of timing out a request after 150ms could be achieved as follows:\n\n```js\nimport AbortController from 'abort-controller';\n\nconst controller = new AbortController();\nconst timeout = setTimeout(\n  () => { controller.abort(); },\n  150,\n);\n\nfetch(url, { signal: controller.signal })\n  .then(res => res.json())\n  .then(\n    data => {\n      useData(data)\n    },\n    err => {\n      if (err.name === 'AbortError') {\n        // request was aborted\n      }\n    },\n  )\n  .finally(() => {\n    clearTimeout(timeout);\n  });\n```\n\nSee [test cases](https://github.com/bitinn/node-fetch/blob/master/test/test.js) for more examples.\n\n\n## API\n\n### fetch(url[, options])\n\n- `url` A string representing the URL for fetching\n- `options` [Options](#fetch-options) for the HTTP(S) request\n- Returns: <code>Promise&lt;[Response](#class-response)&gt;</code>\n\nPerform an HTTP(S) fetch.\n\n`url` should be an absolute url, such as `https://example.com/`. A path-relative URL (`/file/under/root`) or protocol-relative URL (`//can-be-http-or-https.com/`) will result in a rejected promise.\n\n<a id=\"fetch-options\"></a>\n### Options\n\nThe default values are shown after each option key.\n\n```js\n{\n    // These properties are part of the Fetch Standard\n    method: 'GET',\n    headers: {},        // request headers. format is the identical to that accepted by the Headers constructor (see below)\n    body: null,         // request body. can be null, a string, a Buffer, a Blob, or a Node.js Readable stream\n    redirect: 'follow', // set to `manual` to extract redirect headers, `error` to reject redirect\n    signal: null,       // pass an instance of AbortSignal to optionally abort requests\n\n    // The following properties are node-fetch extensions\n    follow: 20,         // maximum redirect count. 0 to not follow redirect\n    timeout: 0,         // req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies). Signal is recommended instead.\n    compress: true,     // support gzip/deflate content encoding. false to disable\n    size: 0,            // maximum response body size in bytes. 0 to disable\n    agent: null         // http(s).Agent instance or function that returns an instance (see below)\n}\n```\n\n##### Default Headers\n\nIf no values are set, the following request headers will be sent automatically:\n\nHeader              | Value\n------------------- | --------------------------------------------------------\n`Accept-Encoding`   | `gzip,deflate` _(when `options.compress === true`)_\n`Accept`            | `*/*`\n`Connection`        | `close` _(when no `options.agent` is present)_\n`Content-Length`    | _(automatically calculated, if possible)_\n`Transfer-Encoding` | `chunked` _(when `req.body` is a stream)_\n`User-Agent`        | `node-fetch/1.0 (+https://github.com/bitinn/node-fetch)`\n\nNote: when `body` is a `Stream`, `Content-Length` is not set automatically.\n\n##### Custom Agent\n\nThe `agent` option allows you to specify networking related options that's out of the scope of Fetch. Including and not limit to:\n\n- Support self-signed certificate\n- Use only IPv4 or IPv6\n- Custom DNS Lookup\n\nSee [`http.Agent`](https://nodejs.org/api/http.html#http_new_agent_options) for more information.\n\nIn addition, `agent` option accepts a function that returns http(s).Agent instance given current [URL](https://nodejs.org/api/url.html), this is useful during a redirection chain across HTTP and HTTPS protocol.\n\n```js\nconst httpAgent = new http.Agent({\n    keepAlive: true\n});\nconst httpsAgent = new https.Agent({\n    keepAlive: true\n});\n\nconst options = {\n    agent: function (_parsedURL) {\n        if (_parsedURL.protocol == 'http:') {\n            return httpAgent;\n        } else {\n            return httpsAgent;\n        }\n    }\n}\n```\n\n<a id=\"class-request\"></a>\n### Class: Request\n\nAn HTTP(S) request containing information about URL, method, headers, and the body. This class implements the [Body](#iface-body) interface.\n\nDue to the nature of Node.js, the following properties are not implemented at this moment:\n\n- `type`\n- `destination`\n- `referrer`\n- `referrerPolicy`\n- `mode`\n- `credentials`\n- `cache`\n- `integrity`\n- `keepalive`\n\nThe following node-fetch extension properties are provided:\n\n- `follow`\n- `compress`\n- `counter`\n- `agent`\n\nSee [options](#fetch-options) for exact meaning of these extensions.\n\n#### new Request(input[, options])\n\n<small>*(spec-compliant)*</small>\n\n- `input` A string representing a URL, or another `Request` (which will be cloned)\n- `options` [Options][#fetch-options] for the HTTP(S) request\n\nConstructs a new `Request` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request).\n\nIn most cases, directly `fetch(url, options)` is simpler than creating a `Request` object.\n\n<a id=\"class-response\"></a>\n### Class: Response\n\nAn HTTP(S) response. This class implements the [Body](#iface-body) interface.\n\nThe following properties are not implemented in node-fetch at this moment:\n\n- `Response.error()`\n- `Response.redirect()`\n- `type`\n- `trailer`\n\n#### new Response([body[, options]])\n\n<small>*(spec-compliant)*</small>\n\n- `body` A string or [Readable stream][node-readable]\n- `options` A [`ResponseInit`][response-init] options dictionary\n\nConstructs a new `Response` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response).\n\nBecause Node.js does not implement service workers (for which this class was designed), one rarely has to construct a `Response` directly.\n\n#### response.ok\n\n<small>*(spec-compliant)*</small>\n\nConvenience property representing if the request ended normally. Will evaluate to true if the response status was greater than or equal to 200 but smaller than 300.\n\n#### response.redirected\n\n<small>*(spec-compliant)*</small>\n\nConvenience property representing if the request has been redirected at least once. Will evaluate to true if the internal redirect counter is greater than 0.\n\n<a id=\"class-headers\"></a>\n### Class: Headers\n\nThis class allows manipulating and iterating over a set of HTTP headers. All methods specified in the [Fetch Standard][whatwg-fetch] are implemented.\n\n#### new Headers([init])\n\n<small>*(spec-compliant)*</small>\n\n- `init` Optional argument to pre-fill the `Headers` object\n\nConstruct a new `Headers` object. `init` can be either `null`, a `Headers` object, an key-value map object, or any iterable object.\n\n```js\n// Example adapted from https://fetch.spec.whatwg.org/#example-headers-class\n\nconst meta = {\n  'Content-Type': 'text/xml',\n  'Breaking-Bad': '<3'\n};\nconst headers = new Headers(meta);\n\n// The above is equivalent to\nconst meta = [\n  [ 'Content-Type', 'text/xml' ],\n  [ 'Breaking-Bad', '<3' ]\n];\nconst headers = new Headers(meta);\n\n// You can in fact use any iterable objects, like a Map or even another Headers\nconst meta = new Map();\nmeta.set('Content-Type', 'text/xml');\nmeta.set('Breaking-Bad', '<3');\nconst headers = new Headers(meta);\nconst copyOfHeaders = new Headers(headers);\n```\n\n<a id=\"iface-body\"></a>\n### Interface: Body\n\n`Body` is an abstract interface with methods that are applicable to both `Request` and `Response` classes.\n\nThe following methods are not yet implemented in node-fetch at this moment:\n\n- `formData()`\n\n#### body.body\n\n<small>*(deviation from spec)*</small>\n\n* Node.js [`Readable` stream][node-readable]\n\nThe data encapsulated in the `Body` object. Note that while the [Fetch Standard][whatwg-fetch] requires the property to always be a WHATWG `ReadableStream`, in node-fetch it is a Node.js [`Readable` stream][node-readable].\n\n#### body.bodyUsed\n\n<small>*(spec-compliant)*</small>\n\n* `Boolean`\n\nA boolean property for if this body has been consumed. Per spec, a consumed body cannot be used again.\n\n#### body.arrayBuffer()\n#### body.blob()\n#### body.json()\n#### body.text()\n\n<small>*(spec-compliant)*</small>\n\n* Returns: <code>Promise</code>\n\nConsume the body and return a promise that will resolve to one of these formats.\n\n#### body.buffer()\n\n<small>*(node-fetch extension)*</small>\n\n* Returns: <code>Promise&lt;Buffer&gt;</code>\n\nConsume the body and return a promise that will resolve to a Buffer.\n\n#### body.textConverted()\n\n<small>*(node-fetch extension)*</small>\n\n* Returns: <code>Promise&lt;String&gt;</code>\n\nIdentical to `body.text()`, except instead of always converting to UTF-8, encoding sniffing will be performed and text converted to UTF-8, if possible.\n\n(This API requires an optional dependency on npm package [encoding](https://www.npmjs.com/package/encoding), which you need to install manually. `webpack` users may see [a warning message](https://github.com/bitinn/node-fetch/issues/412#issuecomment-379007792) due to this optional dependency.)\n\n<a id=\"class-fetcherror\"></a>\n### Class: FetchError\n\n<small>*(node-fetch extension)*</small>\n\nAn operational error in the fetching process. See [ERROR-HANDLING.md][] for more info.\n\n<a id=\"class-aborterror\"></a>\n### Class: AbortError\n\n<small>*(node-fetch extension)*</small>\n\nAn Error thrown when the request is aborted in response to an `AbortSignal`'s `abort` event. It has a `name` property of `AbortError`. See [ERROR-HANDLING.MD][] for more info.\n\n## Acknowledgement\n\nThanks to [github/fetch](https://github.com/github/fetch) for providing a solid implementation reference.\n\n`node-fetch` v1 was maintained by [@bitinn](https://github.com/bitinn); v2 was maintained by [@TimothyGu](https://github.com/timothygu), [@bitinn](https://github.com/bitinn) and [@jimmywarting](https://github.com/jimmywarting); v2 readme is written by [@jkantr](https://github.com/jkantr).\n\n## License\n\nMIT\n\n[npm-image]: https://flat.badgen.net/npm/v/node-fetch\n[npm-url]: https://www.npmjs.com/package/node-fetch\n[travis-image]: https://flat.badgen.net/travis/bitinn/node-fetch\n[travis-url]: https://travis-ci.org/bitinn/node-fetch\n[codecov-image]: https://flat.badgen.net/codecov/c/github/bitinn/node-fetch/master\n[codecov-url]: https://codecov.io/gh/bitinn/node-fetch\n[install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch\n[install-size-url]: https://packagephobia.now.sh/result?p=node-fetch\n[whatwg-fetch]: https://fetch.spec.whatwg.org/\n[response-init]: https://fetch.spec.whatwg.org/#responseinit\n[node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams\n[mdn-headers]: https://developer.mozilla.org/en-US/docs/Web/API/Headers\n[LIMITS.md]: https://github.com/bitinn/node-fetch/blob/master/LIMITS.md\n[ERROR-HANDLING.md]: https://github.com/bitinn/node-fetch/blob/master/ERROR-HANDLING.md\n[UPGRADE-GUIDE.md]: https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md\n",
     85   "readmeFilename": "README.md",
     86   "repository": {
     87     "type": "git",
     88     "url": "git+https://github.com/bitinn/node-fetch.git"
     89   },
     90   "scripts": {
     91     "build": "cross-env BABEL_ENV=rollup rollup -c",
     92     "coverage": "cross-env BABEL_ENV=coverage nyc --reporter json --reporter text mocha -R spec test/test.js && codecov -f coverage/coverage-final.json",
     93     "prepare": "npm run build",
     94     "report": "cross-env BABEL_ENV=coverage nyc --reporter lcov --reporter text mocha -R spec test/test.js",
     95     "test": "cross-env BABEL_ENV=test mocha --require babel-register --throw-deprecation test/test.js"
     96   },
     97   "version": "2.6.0"
     98 }