Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Curl

Wrapper around {@link "Easy".Easy | Easy} class with a more nodejs-friendly interface.

This uses an internal {@link "Multi".Multi | Multi} instance allowing for asynchronous requests.

Hierarchy

  • EventEmitter
    • Curl

Index

Constructors

constructor

  • Parameters

    • Optional cloneHandle: EasyNativeBinding

      {@link "Easy".Easy | Easy} handle that should be used instead of creating a new one.

    Returns Curl

Properties

Protected chunks

chunks: Buffer[] = []

Stores current response payload.

This will not store anything in case NoDataStorage flag is enabled

Protected chunksLength

chunksLength: number = 0

Current response length.

Will always be zero in case NoDataStorage flag is enabled

Protected features

features: CurlFeature = 0

Currently enabled features.

See enable and disable

Protected handle

Internal Easy handle being used

Protected headerChunks

headerChunks: Buffer[] = []

Stores current headers payload.

This will not store anything in case NoDataStorage flag is enabled

Protected headerChunksLength

headerChunksLength: number = 0

Current headers length.

Will always be zero in case NoDataStorage flag is enabled

Protected isRunning

isRunning: boolean = false

Whether this instance is running or not (perform() was called).

Make sure to not change their value, otherwise unexpected behavior would happen.

This is marked as protected only with the TSDoc to not cause a breaking change.

Protected readFunctionStream

readFunctionStream: Readable | null = null

Protected streamContinueNext

streamContinueNext: boolean = false

Protected streamError

streamError: false | Error = false

Protected streamPauseNext

streamPauseNext: boolean = false

Protected streamReadFunctionCallbacksToClean

streamReadFunctionCallbacksToClean: Array<[Readable, string, (...args: any[]) => void]> = []

Protected streamReadFunctionPaused

streamReadFunctionPaused: boolean = false

Protected streamReadFunctionShouldEnd

streamReadFunctionShouldEnd: boolean = false

Protected streamReadFunctionShouldPause

streamReadFunctionShouldPause: boolean = false

Protected streamUserSuppliedProgressFunction

streamUserSuppliedProgressFunction: CurlOptionValueType["xferInfoFunction"] = null

Protected streamWriteFunctionFirstRun

streamWriteFunctionFirstRun: boolean = true

Protected streamWriteFunctionHighWaterMark

streamWriteFunctionHighWaterMark: number | undefined

Protected streamWriteFunctionPaused

streamWriteFunctionPaused: boolean = false

Protected streamWriteFunctionShouldPause

streamWriteFunctionShouldPause: boolean = false

Protected writeFunctionStream

writeFunctionStream: Readable | null = null

Static VERSION_NUM

VERSION_NUM: number = _Curl.VERSION_NUM

Integer representing the current libcurl version.

It was built the following way:

<8 bits major number> | <8 bits minor number> | <8 bits patch number>.

Version 7.69.1 is therefore returned as 0x074501 / 476417

Static defaultMaxListeners

defaultMaxListeners: number

Static defaultUserAgent

defaultUserAgent: string = `node-libcurl/${pkg.version}`

This is the default user agent that is going to be used on all Curl instances.

You can overwrite this in a per instance basis, calling curlHandle.setOpt('USERAGENT', 'my-user-agent/1.0'), or by directly changing this property so it affects all newly created Curl instances.

To disable this behavior set this property to null.

Static Readonly errorMonitor

errorMonitor: unique symbol

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Static getCount

getCount: getCount = multiHandle.getCount

Returns the number of handles currently open in the internal {@link "Multi".Multi | Multi} handle being used.

Static getVersion

getVersion: getVersion = _Curl.getVersion

Returns libcurl version string.

The string shows which libraries libcurl was built with and their versions, example:

libcurl/7.69.1-DEV OpenSSL/1.1.1d zlib/1.2.11 WinIDN libssh2/1.9.0_DEV nghttp2/1.40.0

Static globalCleanup

globalCleanup: globalCleanup = _Curl.globalCleanup

This is automatically called when the process is exiting.

Static globalInit

globalInit: globalInit = _Curl.globalInit

For flags see the the enum CurlGlobalInit.

This is automatically called when the addon is loaded, to disable this, set the environment variable NODE_LIBCURL_DISABLE_GLOBAL_INIT_CALL=false

Static info

info: CurlInfo = _Curl.info

This is a object with members resembling the CURLINFO_* libcurl constants.

It can be used with {@link "Easy".Easy.getInfo | Easy#getInfo} or Curl#getInfo.

See the official documentation of curl_easy_getinfo() for reference.

CURLINFO_EFFECTIVE_URL becomes Curl.info.EFFECTIVE_URL

Static option

option: CurlOption = _Curl.option

This is a object with members resembling the CURLOPT_* libcurl constants.

It can be used with {@link "Easy".Easy.setOpt | Easy#setOpt} or Curl#setOpt.

See the official documentation of curl_easy_setopt() for reference.

CURLOPT_URL becomes Curl.option.URL

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

Protected cleanupReadFunctionStreamEvents

  • cleanupReadFunctionStreamEvents(): void
  • When uploading a stream (by calling setUploadStream) some event listeners are attached to the stream instance. This will remove them so our callbacks are not called anymore.

    Returns void

close

  • close(): void
  • Close this handle.

    NOTE: After closing the handle, it must not be used anymore. Doing so will throw an error.

    Official libcurl documentation: curl_easy_cleanup()

    Returns void

Protected defaultHeaderFunction

  • defaultHeaderFunction(chunk: Buffer, size: number, nmemb: number): number
  • This is the default callback passed to setOpt('HEADERFUNCTION', cb).

    Parameters

    • chunk: Buffer
    • size: number
    • nmemb: number

    Returns number

Protected defaultWriteFunction

  • defaultWriteFunction(chunk: Buffer, size: number, nmemb: number): number
  • This is the default callback passed to setOpt('WRITEFUNCTION', cb).

    Parameters

    • chunk: Buffer
    • size: number
    • nmemb: number

    Returns number

Protected defaultWriteFunctionStreamBased

  • defaultWriteFunctionStreamBased(chunk: Buffer, size: number, nmemb: number): number
  • This is used by the default callback passed to setOpt('WRITEFUNCTION', cb) when the feature to stream response is enabled.

    Parameters

    • chunk: Buffer
    • size: number
    • nmemb: number

    Returns number

disable

  • Disables a feature, must not be used while a request is running.

    Use CurlFeature for predefined constants.

    Parameters

    Returns this

dupHandle

  • dupHandle(shouldCopyEventListeners?: boolean): Curl
  • Duplicate this handle with all their options. Keep in mind that, by default, this also means all event listeners.

    Official libcurl documentation: curl_easy_duphandle()

    Parameters

    • Default value shouldCopyEventListeners: boolean = true

      If you don't want to copy the event listeners, set this to false.

    Returns Curl

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

enable

  • Enables a feature, must not be used while a request is running.

    Use CurlFeature for predefined constants.

    Parameters

    Returns this

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

Protected getHeaders

  • Returns headers from the current stored chunks - if any

    Returns Buffer | HeaderInfo[]

getInfo

  • getInfo(infoNameOrId: never): any
  • getInfo(info: "CERTINFO"): GetInfoReturn<string[]>["data"]
  • getInfo(info: Exclude<CurlInfoName, CurlInfoNameSpecific>): GetInfoReturn["data"]
  • Retrieves some information about the last request made by a handle.

    This overloaded method has never as type for the argument because one of the other overloaded signatures must be used.

    Official libcurl documentation: curl_easy_getinfo()

    Parameters

    • infoNameOrId: never

      Info name or integer value. Use Curl.info for predefined constants.

    Returns any

  • Returns information about the finished connection.

    Official libcurl documentation: curl_easy_getinfo()

    Parameters

    • info: "CERTINFO"

      Info to retrieve. Use {@link "Curl".Curl.info | Curl.info} for predefined constants.

    Returns GetInfoReturn<string[]>["data"]

  • Returns information about the finished connection.

    Official libcurl documentation: curl_easy_getinfo()

    Parameters

    Returns GetInfoReturn["data"]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: (...args: any[]) => void): this
  • on(event: "data", listener: (this: Curl, chunk: Buffer, curlInstance: Curl) => void): this
  • on(event: "header", listener: (this: Curl, chunk: Buffer, curlInstance: Curl) => void): this
  • on(event: "error", listener: (this: Curl, error: Error, errorCode: CurlCode, curlInstance: Curl) => void): this
  • on(event: "stream", listener: (this: Curl, stream: Readable, status: number, headers: Buffer | HeaderInfo[], curlInstance: Curl) => void): this
  • on(event: "end", listener: (this: Curl, status: number, data: string | Buffer, headers: Buffer | HeaderInfo[], curlInstance: Curl) => void): this
  • on(event: string, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

  • Parameters

    • event: "data"
    • listener: (this: Curl, chunk: Buffer, curlInstance: Curl) => void
        • (this: Curl, chunk: Buffer, curlInstance: Curl): void
        • Parameters

          • this: Curl
          • chunk: Buffer
          • curlInstance: Curl

          Returns void

    Returns this

  • Parameters

    • event: "header"
    • listener: (this: Curl, chunk: Buffer, curlInstance: Curl) => void
        • (this: Curl, chunk: Buffer, curlInstance: Curl): void
        • Parameters

          • this: Curl
          • chunk: Buffer
          • curlInstance: Curl

          Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: (this: Curl, error: Error, errorCode: CurlCode, curlInstance: Curl) => void
        • Parameters

          Returns void

    Returns this

  • This is emitted if the StreamResponse feature was enabled.

    Parameters

    • event: "stream"
    • listener: (this: Curl, stream: Readable, status: number, headers: Buffer | HeaderInfo[], curlInstance: Curl) => void
        • (this: Curl, stream: Readable, status: number, headers: Buffer | HeaderInfo[], curlInstance: Curl): void
        • Parameters

          • this: Curl
          • stream: Readable
          • status: number
          • headers: Buffer | HeaderInfo[]
          • curlInstance: Curl

          Returns void

    Returns this

  • The data paramater passed to the listener callback will be one of the following:

    • Empty Buffer if the feature NoDataStorage flag was enabled
    • Non-Empty Buffer if the feature NoDataParsing flag was enabled
    • Otherwise, it will be a string, with the result of decoding the received data as a UTF8 string. If it's a JSON string for example, you still need to call JSON.parse on it. This library does no extra parsing whatsoever.

    The headers parameter passed to the listener callback will be one of the following:

    • Empty Buffer if the feature NoHeaderStorage flag was enabled
    • Non-Empty Buffer if the feature NoHeaderParsing flag was enabled
    • Otherwise, an array of parsed headers for each request libcurl made (if there were 2 redirects before the last request, the array will have 3 elements, one for each request)

    Parameters

    • event: "end"
    • listener: (this: Curl, status: number, data: string | Buffer, headers: Buffer | HeaderInfo[], curlInstance: Curl) => void
        • (this: Curl, status: number, data: string | Buffer, headers: Buffer | HeaderInfo[], curlInstance: Curl): void
        • Parameters

          • this: Curl
          • status: number
          • data: string | Buffer
          • headers: Buffer | HeaderInfo[]
          • curlInstance: Curl

          Returns void

    Returns this

  • Parameters

    • event: string
    • listener: Function

    Returns this

Protected onEnd

  • onEnd(): void
  • Callback called when this handle has finished the request.

    This is called from the internal callback we use with the {@link "Multi".Multi.onMessage | onMessage} method of the global {@link "Multi".Multi | Multi} handle used by all Curl instances.

    This should not be called in any other way.

    Returns void

Protected onError

  • onError(error: Error, errorCode: CurlCode): void
  • Callback called when an error is thrown on this handle.

    This is called from the internal callback we use with the {@link "Multi".Multi.onMessage | onMessage} method of the global {@link "Multi".Multi | Multi} handle used by all Curl instances.

    Parameters

    Returns void

once

  • once(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

pause

  • Use this function to pause / unpause a connection.

    The bitmask argument is a set of bits that sets the new state of the connection.

    Use CurlPause for predefined constants.

    Official libcurl documentation: curl_easy_pause()

    Parameters

    Returns this

perform

  • perform(): this
  • Add this instance to the processing queue. This method should be called only one time per request, otherwise it will throw an error.

    remarks

    This basically calls the {@link "Multi".Multi.addHandle | Multi#addHandle} method.

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

reset

  • reset(): this
  • Reset this handle options to their defaults.

    This will put the handle in a clean state, as if it was just created.

    Official libcurl documentation: curl_easy_reset()

    Returns this

Protected resetInternalState

  • resetInternalState(): void
  • This is used to reset a few properties to their pre-request state.

    Returns void

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

setOpt

  • Sets an option the handle.

    This overloaded method has never as type for the arguments because one of the other overloaded signatures must be used.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • optionIdOrName: never

      Option name or integer value. Use Curl.option for predefined constants.

    • optionValue: never

      The value of the option, value type depends on the option being set.

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option: "SEEKFUNCTION"
    • value: ((this: EasyNativeBinding, offset: number, origin: number) => number) | null

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option: "TRAILERFUNCTION"
    • value: ((this: EasyNativeBinding) => string[] | false) | null

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option: "SHARE"
    • value: Share | null

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option: "GSSAPI_DELEGATION"
    • value: CurlGssApi | null

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option: "PROXY_SSL_OPTIONS"
    • value: CurlSslOpt | null

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option: "PROXYTYPE"
    • value: CurlProxy | null

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

  • Use {@link "Curl".Curl.option|Curl.option} for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns this

setProgressCallback

  • setProgressCallback(cb: ((dltotal: number, dlnow: number, ultotal: number, ulnow: number) => number) | null): this
  • The option XFERINFOFUNCTION was introduced in curl version 7.32.0, versions older than that should use PROGRESSFUNCTION. If you don't want to mess with version numbers you can use this method, instead of directly calling Curl#setOpt.

    NOPROGRESS should be set to false to make this function actually get called.

    Parameters

    • cb: ((dltotal: number, dlnow: number, ultotal: number, ulnow: number) => number) | null

    Returns this

setStreamProgressCallback

  • setStreamProgressCallback(cb: CurlOptionValueType["xferInfoFunction"]): this
  • This sets the callback to be used as the progress function when using any of the stream features.

    This is needed because when this Curl instance is enabled to use streams for upload/download, it needs to set the libcurl progress function option to an internal function.

    If you are using any of the streams features, do not overwrite the progress callback to something else, be it using setOpt or setProgressCallback, as this would cause undefined behavior.

    If are using this callback, there is no need to set the NOPROGRESS option to false (as you normally would).

    Parameters

    • cb: CurlOptionValueType["xferInfoFunction"]

    Returns this

setStreamResponseHighWaterMark

  • setStreamResponseHighWaterMark(highWaterMark: number | null): this
  • Set the param to null to use the Node.js default value.

    remarks

    Only useful when the StreamResponse feature flag is enabled.

    Parameters

    • highWaterMark: number | null

      This will passed directly to the Readable stream created to be returned as the response'

    Returns this

setUploadStream

  • setUploadStream(stream: Readable | null): this
  • This will set an internal READFUNCTION callback that will read all the data from this stream.

    One usage for that is to upload data directly from streams. Example:

     const curl = new Curl()
     curl.setOpt('URL', 'https://some-domain/upload')
     curl.setOpt('UPLOAD', true)
     // so we do not need to set the content length
     curl.setOpt('HTTPHEADER', ['Transfer-Encoding: chunked'])
    
     const filePath = './test.zip'
     const stream = fs.createReadStream(filePath)
     curl.setUploadStream(stream)
    
     curl.setStreamProgressCallback(() => {
       // this will use the default progress callback from libcurl
       return CurlProgressFunc.Continue
     })
    
     curl.on('end', (statusCode, data) => {
       console.log('\n'.repeat(5))
       // data length should be 0, as it was sent using the response stream
       console.log(
         `curl - end - status: ${statusCode} - data length: ${data.length}`,
       )
       curl.close()
     })
     curl.on('error', (error, errorCode) => {
       console.log('\n'.repeat(5))
       console.error('curl - error: ', error, errorCode)
       curl.close()
     })
     curl.perform()

    Multiple calls with the same stream that was previously set has no effect.

    Setting this to null will remove the READFUNCTION callback and disable this behavior.

    remarks

    This option is reset after each request, so if you want to upload the same data again using the same Curl instance, you will need to provide a new stream.

    Make sure your libcurl version is greater than or equal 7.69.1. Versions older than that one are not reliable for streams usage.

    Parameters

    • stream: Readable | null

    Returns this

Protected streamModeProgressFunction

  • streamModeProgressFunction(dltotal: number, dlnow: number, ultotal: number, ulnow: number): number
  • The internal function passed to PROGRESSFUNCTION (XFERINFOFUNCTION on most recent libcurl versions) when using any of the stream features.

    Parameters

    • dltotal: number
    • dlnow: number
    • ultotal: number
    • ulnow: number

    Returns number

upkeep

  • upkeep(): this
  • Perform any connection upkeep checks.

    Official libcurl documentation: curl_easy_upkeep()

    Returns this

Static getVersionInfo

Static getVersionInfoString

  • getVersionInfoString(): string
  • Returns a string that looks like the one returned by

    curl -V

    Example:

    Version: libcurl/7.69.1-DEV OpenSSL/1.1.1d zlib/1.2.11 WinIDN libssh2/1.9.0_DEV nghttp2/1.40.0
    Protocols: dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
    Features: AsynchDNS, IDN, IPv6, Largefile, SSPI, Kerberos, SPNEGO, NTLM, SSL, libz, HTTP2, HTTPS-proxy

    Returns string

Static isVersionGreaterOrEqualThan

  • isVersionGreaterOrEqualThan(x: number, y: number, z?: number): boolean
  • Useful if you want to check if the current libcurl version is greater or equal than another one.

    Parameters

    • x: number

      major

    • y: number

      minor

    • Default value z: number = 0

      patch

    Returns boolean

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc