This is a Node.js wrapper around the binding MultiNativeBinding | native Multi class.

The only extra is that it provides a static field option.

Hierarchy

  • Multi
    • Multi

Constructors

Properties

option: MultiOption = bindings.Curl.multi

Options to be used with setOpt.

See the official documentation of curl_multi_setopt() for reference.

CURLMOPT_MAXCONNECTS becomes Multi.option.MAXCONNECTS

Methods

  • Returns the number of "Easy".Easy | 'Easy' handles that are currently inside this instance

    Returns number

  • Allow to provide a callback that will be called when there are new information about the handles inside this instance.

    This is basically an abstraction over curl_multi_info_read()

    Pass null to remove the current callback set.

    Parameters

    • cb:
          | null
          | (
              error: Error,
              easyHandle: EasyNativeBinding,
              errorCode: CurlCode,
          ) => void

    Returns this

  • Sets the PIPELINING option.

    Official libcurl documentation: curl_multi_setopt()

    Parameters

    Returns CurlMultiCode

  • Sets the PUSHFUNCTION option.

    Parameters

    • option: "PUSHFUNCTION"
    • value: (
          parent: EasyNativeBinding,
          duplicatedHandle: EasyNativeBinding,
          pushFrameHeaders: Http2PushFrameHeaders,
      ) => CurlPush

    Returns CurlMultiCode

    You must not use the Http2PushFrameHeaders object outside of this callback, doing so will try to use memory that libcurl has already freed and, in the best case scenario, will cause a segmentation fault.

    In case you have denied the push, you must also not use the duplicatedHandle outside of this callback, as libcurl would already have closed it and you would try to access memory that has been freed.

    Errors thrown inside this callback will have the same effect than returning CurlPush.Deny.

    Per a libcurl limitation, there is no direct way to cancel the connection from inside this callback, a possible workaround is to return an error from another callback, like the progress one.

    Official libcurl documentation: curl_multi_setopt()

  • Sets options on this instance.

    Use "Multi".Multi.multi | Multi.option for predefined constants.

    Official libcurl documentation: curl_multi_setopt()

    Parameters

    • option:
          | "MAXCONNECTS"
          | "CHUNK_LENGTH_PENALTY_SIZE"
          | "CONTENT_LENGTH_PENALTY_SIZE"
          | "MAX_CONCURRENT_STREAMS"
          | "MAX_HOST_CONNECTIONS"
          | "MAX_PIPELINE_LENGTH"
          | "MAX_TOTAL_CONNECTIONS"
          | "PIPELINING_SERVER_BL"
          | "PIPELINING_SITE_BL"
          | "PUSHDATA"
          | "PUSHFUNCTION"
          | "SOCKETDATA"
          | "SOCKETFUNCTION"
          | "TIMERDATA"
          | "TIMERFUNCTION"
    • value: number

    Returns CurlMultiCode