FANbbs社区圈子源码社区论坛圈子小程序源码币圈子社区社区管理平台开发源码.zip

资讯 2024-07-09 阅读:44 评论:0
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
<div align="center"> <br> <br> <img width="360" src=https://download.csdn.net/download/unbelievevc/"media/logo.svg" alt="Got"> <br> <br> <br> <p align="center">Huge thanks to <a href=https://download.csdn.net/download/unbelievevc/"https://moxy.studio"><img src=https://download.csdn.net/download/unbelievevc/"https://sindresorhus.com/assets/thanks/moxy-logo.svg" valign="middle" width="150"></a> for sponsoring Sindre Sorhus! </p> <p align="center"><sup>(they love Got too!)</sup></p> <br> <br> </div> > Human-friendly and powerful HTTP request library for Node.js [![Build Status: Linux](https://travis-ci.com/sindresorhus/got.svg?branch=master)](https://travis-ci.com/github/sindresorhus/got) [![Coverage Status](https://coveralls.io/repos/github/sindresorhus/got/badge.svg?branch=master)](https://coveralls.io/github/sindresorhus/got?branch=master) [![Downloads](https://img.shields.io/npm/dm/got.svg)](https://npmjs.com/got) [![Install size](https://packagephobia.now.sh/badge?p=got)](https://packagephobia.now.sh/result?p=got) [Moving from Request?](documentation/migration-guides.md) [*(Note that Request is unmaintained)*](https://github.com/request/request/issues/3142) [See how Got compares to other HTTP libraries](#comparison) For browser usage, we recommend [Ky](https://github.com/sindresorhus/ky) by the same people. ## Highlights - [Promise API](#api) - [Stream API](#streams) - [Pagination API](#pagination) - [HTTP2 support](#http2) - [Request cancelation](#aborting-the-request) - [RFC compliant caching](#cache-adapters) - [Follows redirects](#followredirect) - [Retries on failure](#retry) - [Progress events](#onuploadprogress-progress) - [Handles gzip/deflate/brotli](#decompress) - [Timeout handling](#timeout) - [Errors with metadata](#errors) - [JSON mode](#json-mode) - [WHATWG URL support](#url) - [HTTPS API](#advanced-https-api) - [Hooks](#hooks) - [Instances with custom defaults](#instances) - [Types](#types) - [Composable](documentation/advanced-creation.md#merging-instances) - [Plugins](documentation/lets-make-a-plugin.md) - [Used by 4K+ packages and 1.8M+ repos](https://github.com/sindresorhus/got/network/dependents) - [Actively maintained](https://github.com/sindresorhus/got/graphs/contributors) - [Trusted by many companies](#widely-used) ## Install ``` $ npm install got ``` ## Usage ###### Promise ```js const got=require('got'); (async ()=> { try { const response=await got('https://sindresorhus.com'); console.log(response.body); //=> '<!doctype html> ...' } catch (error) { console.log(error.response.body); //=> 'Internal server error ...' } })(); ``` ###### JSON ```js const got=require('got'); (async ()=> { const {body}=await got.post('https://httpbin.org/anything', { json: { hello: 'world' }, responseType: 'json' }); console.log(body.data); //=> {hello: 'world'} })(); ``` See [JSON mode](#json-mode) for more details. ###### Streams ```js const stream=require('stream'); const {promisify}=require('util'); const fs=require('fs'); const got=require('got'); const pipeline=promisify(stream.pipeline); (async ()=> { await pipeline( got.stream('https://sindresorhus.com'), fs.createWriteStream('index.html') ); // For POST, PUT, PATCH, and DELETE methods, `got.stream` returns a `stream.Writable`. await pipeline( fs.createReadStream('index.html'), got.stream.post('https://sindresorhus.com') ); })(); ``` **Tip:** `from.pipe(to)` doesn't forward errors. Instead, use [`stream.pipeline(from, ..., to, callback)`](https://nodejs.org/api/stream.html#stream_stream_pipeline_streams_callback). **Note:** While `got.post('https://example.com')` resolves, `got.stream.post('https://example.com')` will hang indefinitely until a body is provided. If there's no body on purpose, remember to `.end()` the stream or set the [`body`](#body) option to an empty string. ### API It's a `GET` request by default, but can be changed by using different methods or via [`options.method`](#method). **By default, Got will retry on failure. To disable this option, set [`options.retry`](#retry) to `0`.** #### got(url?, options?) Returns a Promise giving a [Response object](#response) or a [Got Stream](#streams-1) if `options.isStream` is set to true. ##### url Type: `string | object` The URL to request, as a string, a [`https.request` options object](https://nodejs.org/api/https.html#https_https_request_options_callback), or a [WHATWG `URL`](https://nodejs.org/api/url.html#url_class_url). Properties from `options` will override properties in the parsed `url`. If no protocol is specified, it will throw a `TypeError`. **Note:** The query string is **not** parsed as search params. Example: ```js got('https://example.com/?query=a b'); //=> https://example.com/?query=a%20b got('https://example.com/', {searchParams: {query: 'a b'}}); //=> https://example.com/?query=a+b // The query string is overridden by `searchParams` got('https://example.com/?query=a b', {searchParams: {query: 'a b'}}); //=> https://example.com/?query=a+b ``` ##### options Type: `object` Any of the [`https.request`](https://nodejs.org/api/https.html#https_https_request_options_callback) options. **Note:** Legacy URL support is disabled. `options.path` is supported only for backwards compatibility. Use `options.pathname` and `options.searchParams` instead. `options.auth` has been replaced with `options.username` & `options.password`. ###### method Type: `string`\ Default: `GET` The HTTP method used to make the request. ###### prefixUrl Type: `string | URL` When specified, `prefixUrl` will be prepended to `url`. The prefix can be any valid URL, either relative or absolute.\ A trailing slash `/` is optional - one will be added automatically. **Note:** `prefixUrl` will be ignored if the `url` argument is a URL instance. **Note:** Leading slashes in `input` are disallowed when using this option to enforce consistency and avoid confusion. For example, when the prefix URL is `https://example.com/foo` and the input is `/bar`, there's ambiguity whether the resulting URL would become `https://example.com/foo/bar` or `https://example.com/bar`. The latter is used by browsers. **Tip:** Useful when used with [`got.extend()`](#custom-endpoints) to create niche-specific Got instances. **Tip:** You can change `prefixUrl` using hooks as long as the URL still includes the `prefixUrl`. If the URL doesn't include it anymore, it will throw. ```js const got=require('got'); (async ()=> { await got('unicorn', {prefixUrl: 'https://cats.com'}); //=> 'https://cats.com/unicorn' const instance=got.extend({ prefixUrl: 'https://google.com' }); await instance('unicorn', { hooks: { beforeRequest: [ options=> { options.prefixUrl='https://cats.com'; } ] } }); //=> 'https://cats.com/unicorn' })(); ``` ###### headers Type: `object`\ Default: `{}` Request headers. Existing headers will be overwritten. Headers set to `undefined` will be omitted. ###### isStream Type: `boolean`\ Default: `false` Returns a `Stream` instead of a `Promise`. This is equivalent to calling `got.stream(url, options?)`. ###### body Type: `string | Buffer | stream.Readable` or [`form-data` instance](https://github.com/form-data/form-data) **Note #1:** The `body` option cannot be used with the `json` or `form` option. **Note #2:** If you provide this option, `got.stream()` will be read-only. **Note #3:** If you provide a payload with the `GET` or `HEAD` method, it will throw a `TypeError` unless the method is `GET` and the `allowGetBody` option is set to `true`. **Note #4:** This option is not enumerable and will not be merged with the instance defaults. The `content-length` header will be automatically set if `body` is a `string` / `Buffer` / `fs.createReadStream` instance / [`form-data` instance](https://github.com/form-data/form-data), and `content-length` and `transfer-encoding` are not manually set in `options.headers`. ###### json Type: `object | Array | number | string | boolean | null` *(JSON-serializable values)* **Note #1:** If you provide thi
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明

分享:

扫一扫在手机阅读、分享本文

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
热门文章
  • 12年怎么购买比特币?比特币投资,轻松掌控

    12年怎么购买比特币?比特币投资,轻松掌控
    12年怎么购买比特币?买卖比特币可以通过以下交易所进行购买,分别是:欧易官网平台、ZG交易所、艾戴克斯交易所、C2CX交易软件、BaseFEX交易APP、波网交易平台、安银交易所、BitMart交易软件、紫牛币交所交易APP和澳网(AOMEX)交易平台等等十大平台下载,高效安全的数字货币交易平台。How do you buy bitcoins in 12 years? Bitcoins can be purchased through ten major platforms...
  • 0.00003374个比特币等于多少人民币/美金

    0.00003374个比特币等于多少人民币/美金
    0.00003374比特币等于多少人民币?根据比特币对人民币的最新汇率,0.00003374比特币等于2.2826 1222美元/16.5261124728人民币。比特币(BTC)美元(USDT)人民币(CNY)0.00003374克洛克-0/22216.5261124728比特币对人民币的最新汇率为:489807.72 CNY(1比特币=489807.72人民币)(1美元=7.24人民币)(0.00003374USDT=0.0002442776 CNY)。汇率更新于2024...
  • 134 USD toBTC Calculator -

    134                            USD                        toBTC                        Calculator -
    For the week (7 days) Date Day 134 USD to BTC Changes Changes % June...
  • 0.00006694个比特币等于多少人民币/美金

    0.00006694个比特币等于多少人民币/美金
    0.00006694比特币等于多少人民币?根据比特币对人民币的最新汇率,0.00006694比特币等于4.53424784美元/32.5436 16人民币。比特币(BTC)美元(USDT)人民币(CNY)0.000066944.53424784【比特币密码】32.82795436 16比特币对人民币的最新汇率为:490408.64 CNY(1比特币=490408.64人民币)(1美元=7.24人民币)(0.00006694USDT=0.0004846456 CNY)汇率更新时...
  • ??【原标题】监管!打击!扶持!直销行业强监管仍将持续;持续打击虚拟货币交易炒作;公销社APP涉传被罚没1647万

    ??【原标题】监管!打击!扶持!直销行业强监管仍将持续;持续打击虚拟货币交易炒作;公销社APP涉传被罚没1647万
    2022年3月3日,湖南省市场监督管理局召开全省市场监管系统党风廉政建设工作会议。湖南省市场监督管理局党组书记、局长向曙光,党组副书记、副局长钱俊君,党组成员、省药监局党组书记梁毅恒,副局长李沐,省纪委监委驻省局...
标签列表