This is a Node.js wrapper around the binding EasyNativeBinding | native Easy class

Hierarchy

  • Easy
    • Easy

Constructors

Properties

isInsideMultiHandle: boolean

This will be true if the handle was added to a MultiNativeBinding | Multi handle.

isMonitoringSockets: boolean

This will be true if monitorSocketEvents was called.

isOpen: boolean

This will be true if close was not called.

private: any

You can set this to anything - Use it to bind some data to this Easy instance.

This will not be copied to other instaces created when duplicating this one.

Methods

  • Close this handle and dispose any resources bound to it. After closed, the handle MUST not be used again, doing so will throw an Error.

    This is basically the same than curl_easy_cleanup()

    Returns void

  • Official libcurl documentation: curl_easy_getinfo()

    Parameters

    • info: "CERTINFO"

      Info to retrieve. Use "Curl".Curl.info | Curl.info for predefined constants.

    Returns GetInfoReturn<string[]>

  • Returns information about the finished connection.

    Official libcurl documentation: curl_easy_getinfo()

    Parameters

    • info:
          | "ACTIVESOCKET"
          | "APPCONNECT_TIME"
          | "APPCONNECT_TIME_T"
          | "CAINFO"
          | "CAPATH"
          | "CONDITION_UNMET"
          | "CONNECT_TIME"
          | "CONNECT_TIME_T"
          | "CONTENT_LENGTH_DOWNLOAD"
          | "CONTENT_LENGTH_DOWNLOAD_T"
          | "CONTENT_LENGTH_UPLOAD"
          | "CONTENT_LENGTH_UPLOAD_T"
          | "CONTENT_TYPE"
          | "COOKIELIST"
          | "EFFECTIVE_METHOD"
          | "EFFECTIVE_URL"
          | "FILETIME"
          | "FILETIME_T"
          | "FTP_ENTRY_PATH"
          | "HEADER_SIZE"
          | "HTTP_CONNECTCODE"
          | "HTTP_VERSION"
          | "HTTPAUTH_AVAIL"
          | "LASTSOCKET"
          | "LOCAL_IP"
          | "LOCAL_PORT"
          | "NAMELOOKUP_TIME"
          | "NAMELOOKUP_TIME_T"
          | "NUM_CONNECTS"
          | "OS_ERRNO"
          | "PRETRANSFER_TIME"
          | "PRETRANSFER_TIME_T"
          | "PRIMARY_IP"
          | "PRIMARY_PORT"
          | "PRIVATE"
          | "PROTOCOL"
          | "PROXY_ERROR"
          | "PROXY_SSL_VERIFYRESULT"
          | "PROXYAUTH_AVAIL"
          | "REDIRECT_COUNT"
          | "REDIRECT_TIME"
          | "REDIRECT_TIME_T"
          | "REDIRECT_URL"
          | "REFERER"
          | "REQUEST_SIZE"
          | "RESPONSE_CODE"
          | "RETRY_AFTER"
          | "RTSP_CLIENT_CSEQ"
          | "RTSP_CSEQ_RECV"
          | "RTSP_SERVER_CSEQ"
          | "RTSP_SESSION_ID"
          | "SCHEME"
          | "SIZE_DOWNLOAD"
          | "SIZE_DOWNLOAD_T"
          | "SIZE_UPLOAD"
          | "SIZE_UPLOAD_T"
          | "SPEED_DOWNLOAD"
          | "SPEED_DOWNLOAD_T"
          | "SPEED_UPLOAD"
          | "SPEED_UPLOAD_T"
          | "SSL_ENGINES"
          | "SSL_VERIFYRESULT"
          | "STARTTRANSFER_TIME"
          | "STARTTRANSFER_TIME_T"
          | "TLS_SESSION"
          | "TLS_SSL_PTR"
          | "TOTAL_TIME"
          | "TOTAL_TIME_T"

      Info to retrieve. Use "Curl".Curl.info | Curl.info for predefined constants.

    Returns GetInfoReturn

  • Start monitoring for events in the connection socket used by this handle.

    This is only useful if using the onSocketEvent callback.

    This method will throw an Error if the handle is already monitoring socket events. You can use isMonitoringSockets to check if socket events are already being monitored or not.

    Returns this

  • This method is only useful when the internal polling of the connection socket is enabled by calling monitorSocketEvents.

    The passed callback is going to be called everytime there are changes to the connection socket.

    One use case for this is when using the send and recv methods

    A full example is available at examples/15-send-recv-methods.js

    Pass null to remove the current callback set.

    Parameters

    • cb: null | (error: null | Error, events: SocketState) => void

    Returns this

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option: DataCallbackOptions
    • value:
          | null
          | (
              this: EasyNativeBinding,
              data: Buffer,
              size: number,
              nmemb: number,
          ) => number

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option: ProgressCallbackOptions
    • value:
          | null
          | (
              this: EasyNativeBinding,
              dltotal: number,
              dlnow: number,
              ultotal: number,
              ulnow: number,
          ) => number

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option: StringListOptions
    • value: null | string[]

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option: BlobOptions
    • value: null | string | Buffer | ArrayBuffer

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option: "CHUNK_BGN_FUNCTION"
    • value:
          | null
          | (
              this: EasyNativeBinding,
              fileInfo: FileInfo,
              remains: number,
          ) => CurlChunk

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option: "CHUNK_END_FUNCTION"
    • value: null | (this: EasyNativeBinding) => CurlChunk

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option: "DEBUGFUNCTION"
    • value: null | (this: EasyNativeBinding, type: CurlInfoDebug, data: Buffer) => 0

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option: "FNMATCH_FUNCTION"
    • value:
          | null
          | (
              this: EasyNativeBinding,
              pattern: string,
              value: string,
          ) => CurlFnMatchFunc

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    You can either return a single CurlHstsReadCallbackResult object or an array of CurlHstsReadCallbackResult objects. If returning an array, the callback will only be called once per request. If returning a single object, the callback will be called multiple times until null is returned.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option: "HSTSWRITEFUNCTION"
    • value:
          | null
          | (
              this: EasyNativeBinding,
              cacheEntry: CurlHstsCacheEntry,
              cacheCount: CurlHstsCacheCount,
          ) => any

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option: "PREREQFUNCTION"
    • value:
          | null
          | (
              this: EasyNativeBinding,
              connPrimaryIp: string,
              connLocalIp: string,
              connPrimaryPort: number,
              conLocalPort: number,
          ) => CurlPreReqFunc

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

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

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

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

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

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

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

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

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

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

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option: "HSTS_CTRL"
    • value: null | CurlHsts

    Returns CurlCode

  • Use "Curl".Curl.option|Curl.option for predefined constants.

    Official libcurl documentation: curl_easy_setopt()

    Parameters

    • option:
          | "CAINFO"
          | "CAPATH"
          | "CERTINFO"
          | "COOKIELIST"
          | "FILETIME"
          | "REFERER"
          | "RTSP_CLIENT_CSEQ"
          | "RTSP_SERVER_CSEQ"
          | "RTSP_SESSION_ID"
          | "ABSTRACT_UNIX_SOCKET"
          | "ACCEPT_ENCODING"
          | "ACCEPTTIMEOUT_MS"
          | "ADDRESS_SCOPE"
          | "ALTSVC"
          | "ALTSVC_CTRL"
          | "APPEND"
          | "AUTOREFERER"
          | "AWS_SIGV4"
          | "BUFFERSIZE"
          | "CONNECT_ONLY"
          | "CONNECTTIMEOUT"
          | "CONNECTTIMEOUT_MS"
          | "COOKIE"
          | "COOKIEFILE"
          | "COOKIEJAR"
          | "COOKIESESSION"
          | "CRLF"
          | "CRLFILE"
          | "CUSTOMREQUEST"
          | "DEFAULT_PROTOCOL"
          | "DIRLISTONLY"
          | "DISALLOW_USERNAME_IN_URL"
          | "DNS_CACHE_TIMEOUT"
          | "DNS_INTERFACE"
          | "DNS_LOCAL_IP4"
          | "DNS_LOCAL_IP6"
          | "DNS_SERVERS"
          | "DNS_SHUFFLE_ADDRESSES"
          | "DNS_USE_GLOBAL_CACHE"
          | "DOH_SSL_VERIFYHOST"
          | "DOH_SSL_VERIFYPEER"
          | "DOH_SSL_VERIFYSTATUS"
          | "DOH_URL"
          | "EGDSOCKET"
          | "EXPECT_100_TIMEOUT_MS"
          | "FAILONERROR"
          | "FOLLOWLOCATION"
          | "FORBID_REUSE"
          | "FRESH_CONNECT"
          | "FTP_ACCOUNT"
          | "FTP_ALTERNATIVE_TO_USER"
          | "FTP_CREATE_MISSING_DIRS"
          | "FTP_SKIP_PASV_IP"
          | "FTP_USE_EPRT"
          | "FTP_USE_EPSV"
          | "FTP_USE_PRET"
          | "FTPPORT"
          | "FTPSSLAUTH"
          | "HAPPY_EYEBALLS_TIMEOUT_MS"
          | "HAPROXYPROTOCOL"
          | "HEADER"
          | "HSTS"
          | "HTTP_CONTENT_DECODING"
          | "HTTP_TRANSFER_DECODING"
          | "HTTP09_ALLOWED"
          | "HTTPAUTH"
          | "HTTPGET"
          | "HTTPPROXYTUNNEL"
          | "IGNORE_CONTENT_LENGTH"
          | "INFILESIZE"
          | "INFILESIZE_LARGE"
          | "INTERFACE"
          | "ISSUERCERT"
          | "KEEP_SENDING_ON_ERROR"
          | "KEYPASSWD"
          | "KRBLEVEL"
          | "LOCALPORT"
          | "LOCALPORTRANGE"
          | "LOGIN_OPTIONS"
          | "LOW_SPEED_LIMIT"
          | "LOW_SPEED_TIME"
          | "MAIL_AUTH"
          | "MAIL_FROM"
          | "MAIL_RCPT_ALLLOWFAILS"
          | "MAX_RECV_SPEED_LARGE"
          | "MAX_SEND_SPEED_LARGE"
          | "MAXAGE_CONN"
          | "MAXCONNECTS"
          | "MAXFILESIZE"
          | "MAXFILESIZE_LARGE"
          | "MAXLIFETIME_CONN"
          | "MAXREDIRS"
          | "NETRC_FILE"
          | "NEW_DIRECTORY_PERMS"
          | "NEW_FILE_PERMS"
          | "NOBODY"
          | "NOPROGRESS"
          | "NOPROXY"
          | "NOSIGNAL"
          | "PASSWORD"
          | "PATH_AS_IS"
          | "PINNEDPUBLICKEY"
          | "PIPEWAIT"
          | "PORT"
          | "POST"
          | "POSTFIELDS"
          | "POSTFIELDSIZE"
          | "POSTFIELDSIZE_LARGE"
          | "POSTREDIR"
          | "PRE_PROXY"
          | "PROTOCOLS_STR"
          | "PROXY"
          | "PROXY_CAINFO"
          | "PROXY_CAPATH"
          | "PROXY_CRLFILE"
          | "PROXY_ISSUERCERT"
          | "PROXY_ISSUERCERT_BLOB"
          | "PROXY_KEYPASSWD"
          | "PROXY_PINNEDPUBLICKEY"
          | "PROXY_SERVICE_NAME"
          | "PROXY_SSL_CIPHER_LIST"
          | "PROXY_SSL_VERIFYHOST"
          | "PROXY_SSL_VERIFYPEER"
          | "PROXY_SSLCERTTYPE"
          | "PROXY_SSLKEY"
          | "PROXY_SSLKEYTYPE"
          | "PROXY_SSLVERSION"
          | "PROXY_TLS13_CIPHERS"
          | "PROXY_TLSAUTH_PASSWORD"
          | "PROXY_TLSAUTH_TYPE"
          | "PROXY_TLSAUTH_USERNAME"
          | "PROXY_TRANSFER_MODE"
          | "PROXYAUTH"
          | "PROXYPASSWORD"
          | "PROXYPORT"
          | "PROXYUSERNAME"
          | "PROXYUSERPWD"
          | "PUT"
          | "RANDOM_FILE"
          | "RANGE"
          | "READDATA"
          | "REDIR_PROTOCOLS_STR"
          | "REQUEST_TARGET"
          | "RESUME_FROM"
          | "RESUME_FROM_LARGE"
          | "RTSP_STREAM_URI"
          | "RTSP_TRANSPORT"
          | "SASL_AUTHZID"
          | "SASL_IR"
          | "SERVER_RESPONSE_TIMEOUT"
          | "SERVICE_NAME"
          | "SOCKS5_AUTH"
          | "SOCKS5_GSSAPI_NEC"
          | "SOCKS5_GSSAPI_SERVICE"
          | "SSH_COMPRESSION"
          | "SSH_HOST_PUBLIC_KEY_MD5"
          | "SSH_HOSTKEYDATA"
          | "SSH_KNOWNHOSTS"
          | "SSH_PRIVATE_KEYFILE"
          | "SSH_PUBLIC_KEYFILE"
          | "SSL_CIPHER_LIST"
          | "SSL_EC_CURVES"
          | "SSL_ENABLE_ALPN"
          | "SSL_ENABLE_NPN"
          | "SSL_FALSESTART"
          | "SSL_SESSIONID_CACHE"
          | "SSL_VERIFYHOST"
          | "SSL_VERIFYPEER"
          | "SSL_VERIFYSTATUS"
          | "SSLCERT"
          | "SSLCERTTYPE"
          | "SSLENGINE"
          | "SSLENGINE_DEFAULT"
          | "SSLKEY"
          | "SSLKEYTYPE"
          | "SUPPRESS_CONNECT_HEADERS"
          | "TCP_FASTOPEN"
          | "TCP_KEEPALIVE"
          | "TCP_KEEPIDLE"
          | "TCP_KEEPINTVL"
          | "TCP_NODELAY"
          | "TFTP_BLKSIZE"
          | "TFTP_NO_OPTIONS"
          | "TIMEOUT"
          | "TIMEOUT_MS"
          | "TIMEVALUE"
          | "TIMEVALUE_LARGE"
          | "TLS13_CIPHERS"
          | "TLSAUTH_PASSWORD"
          | "TLSAUTH_TYPE"
          | "TLSAUTH_USERNAME"
          | "TRANSFER_ENCODING"
          | "TRANSFERTEXT"
          | "UNIX_SOCKET_PATH"
          | "UNRESTRICTED_AUTH"
          | "UPKEEP_INTERVAL_MS"
          | "UPLOAD"
          | "UPLOAD_BUFFERSIZE"
          | "URL"
          | "USERAGENT"
          | "USERNAME"
          | "USERPWD"
          | "VERBOSE"
          | "WILDCARDMATCH"
          | "XOAUTH2_BEARER"
    • value: null | string | number | boolean

    Returns CurlCode

  • Stop monitoring for events in the connection socket used by this handle.

    This method will throw an Error if the handle is not monitoring socket events. You can use isMonitoringSockets to check if socket events are already being monitored or not.

    Returns this