Tabnine Logo For Javascript
Request.req
Code IndexAdd Tabnine to your IDE (free)

How to use
req
function
in
Request

Best JavaScript code snippets using request.Request.req(Showing top 2 results out of 315)

origin: tencentyun/cos-nodejs-sdk-v5

// 在 request 分配的 socket 上挂载 _lastBytesWritten 属性,记录该 socket 已经发送的字节数
  var markLastBytesWritten = function() {
    try {
      Object.defineProperty(sender.req.connection, '_lastBytesWritten', {
        enumerable: true,
        configurable: true,
        writable: true,
        value: sender.req.connection.bytesWritten
      });
    } catch(e) {
    }
  }
origin: tencentyun/cos-nodejs-sdk-v5

sender.on('drain', function () {
      var time1 = Date.now();
      var loaded = 0;
      try {
        // 已经上传的字节数 = socket当前累计发送的字节数 - 头部长度 - socket以前发送的字节数
        loaded = sender.req.connection.bytesWritten - sender.req._header.length - (sender.req.connection._lastBytesWritten || 0);
      } catch (e) {
      }
      var total = contentLength;
      var speed = parseInt((loaded - size0) / ((time1 - time0) / 1000) * 100) / 100;
      var percent = total ? (parseInt(loaded / total * 100) / 100) : 0;
      time0 = time1;
      size0 = loaded;
      params.onProgress({
        loaded: loaded,
        total: total,
        speed: speed,
        percent: percent,
      });
    });
request(npm)Requestreq

Most used request functions

  • request
  • Response.statusCode
  • RequestAPI.post
  • RequestAPI.get
  • Request.pipe
  • rp,
  • Request.on,
  • Response.headers,
  • RequestAPI.defaults,
  • RequestAPI.put,
  • RequestAPI.jar,
  • Response.statusMessage,
  • RequestAPI.head,
  • Response.on,
  • RequestAPI.cookie,
  • RequestAPI.delete,
  • Response.pipe,
  • RequestAPI.del,
  • requestRetry

Popular in JavaScript

  • path
  • ws
    Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js
  • js-yaml
    YAML 1.2 parser and serializer
  • mocha
    simple, flexible, fun test framework
  • redis
    Redis client library
  • aws-sdk
    AWS SDK for JavaScript
  • colors
    get colors in your node.js console
  • node-fetch
    A light-weight module that brings window.fetch to node.js
  • yargs
    yargs the modern, pirate-themed, successor to optimist.
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now