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

How to use
on
function
in
Request

Best JavaScript code snippets using request.Request.on(Showing top 15 results out of 684)

origin: eashish93/imgsquash

.on('response', (resp) => {
.on('error', (err) => {
  log.warn(err, 'Error into getting url. Route: /dl/:id');
  return errors.internalServer(res);
origin: eashish93/imgsquash

request
  .get(url.href)
  .on('response', (resp) => {
    resp.on('data', (chunk) => {
      if(image.size > MAX_FILE_SIZE + 1024*10) {    // maxFileSize + 10KB padding.
        isMaxFileSizeExceed = true;
  .on('end', () => {
    if(isResponseSent) return;
    if(isMaxFileSizeExceed)
      .on('error', (err) => {
        log.error(err, 'Error uploading file');
        return errors.internalServer(res);
      })
      .on('finish', async () => {
        const metadata = await gcsFile.getMetadata();
        await gcsFile.makePublic();
origin: nayrnet/node-dahua-api

request(BASEURI + '/cgi-bin/snapshot.cgi?' + options.channel , function (error, response, body) {
  if ((error) || (response.statusCode !== 200)) {
   self.emit("error", 'ERROR ON SNAPSHOT');
  } 
 })
 .on('end',function(){
  if(TRACE) console.log('SNAPSHOT SAVED');
  self.emit("getSnapshot", {
  'status':'DONE',});
 })
 .auth(USER,PASS,false).pipe(fs.createWriteStream(path.join(options.path,options.filename)));
origin: anjanms/DubAPI

req.on('error', function(err) {
    if (queueItem.isChat && err.code === 'ETIMEDOUT') err = new DubAPIError('Chat request timed out');

    that._.dubAPI.emit('error', err);

    //Will not work for chat request timeouts
    if (!queueItem.isRetry && ['ETIMEDOUT', 'ECONNRESET', 'ESOCKETTIMEDOUT'].indexOf(err.code) !== -1) {
      queueItem.isRetry = true;
      that._.queue.unshift(queueItem);
      if (!that._.ticking || queueItem.isChat) that._tick();
      return;
    }

    if (queueItem.isChat) that._tick();
  });
origin: selcukfatihsevinc/app.io

req.on('response', function (res) {
    var stream = this;

    if (res.statusCode != 200) {
      self._log.error(group, 'bad status code');
      return self._done();
    }

    stream.pipe(parser);
  });
origin: Pitu/Kuro

require('request')
    .get(url)
    .on('error', (err) => {
      kuro.log(err)
      _msg.edit(`***Error:*** ${err}`)
    })
    .pipe(fs.createWriteStream(dest))
origin: IBM/MAX-Object-Detector-Web-App

app.all('/model/:route', function(req, res) {
 req.pipe(request(args.model + req.path))
  .on('error', function(err) {
   console.error(err);
   res.status(500).send('Error connecting to the model microservice');
  })
  .pipe(res);
});
origin: anjanms/DubAPI

req.on('complete', function(res, body) {
    if (!queueItem.isRetry && res.statusCode === 302 && res.headers.location === '/auth/login') {
      that._.dubAPI._.actHandler.doLogin(function(err) {
        if (err) that._.dubAPI.emit('error', err);

        queueItem.isRetry = true;
        that._.queue.unshift(queueItem);
        if (!that._.ticking || queueItem.isChat) that._tick();
      });
      return;
    }

    if (queueItem.isChat) that._tick();

    if (typeof queueItem.callback === 'function') queueItem.callback(res.statusCode, body);
    else if (res.statusCode !== 200) that._.dubAPI.emit('error', new DubAPIRequestError(res.statusCode, queueItem.options.url));
  });
origin: nayrnet/node-dahua-api

client.on('socket', function(socket) {
   // Set keep-alive probes - throws ESOCKETTIMEDOUT error after ~16min if connection broken
   NetKeepAlive.setKeepAliveInterval(socket, 1000);
   if (TRACE) console.log('TCP_KEEPINTVL:',NetKeepAlive.getKeepAliveInterval(socket)); 
   
   NetKeepAlive.setKeepAliveProbes(socket, 1);
   if (TRACE) console.log('TCP_KEEPCNT:',NetKeepAlive.getKeepAliveProbes(socket));
   
  });
origin: ruttyj/FlowerShop

app.get(/.*/, (req, res) => {
 request(`http://localhost:${config.portNumber}/`)
  .on("error", (err) => res.sendFile("loading.html", { root: __dirname }))
  .pipe(res);
});
origin: braydonf/gpk

// something went wrong downloading the tarball?
   req.on('error', function (err) {
    if (err.code === 'ENOTFOUND') {
     return cb(new Error('This is most likely not a problem with node-gyp or the package itself and\n' +
      'is related to network connectivity. In most cases you are behind a proxy or have bad \n' +
      'network settings.'))
    }
    badDownload = true
    cb(err)
   })
origin: dwqs/tech-read

req.on('response', (res) => {
      if(res.statusCode === 200) {
        urlPath = res.client._httpMessage._headers.host + res.client._httpMessage.path;
        resolve(urlPath);
      }
    });
origin: braydonf/gpk

req.on('close', function () {
    if (extractCount === 0) {
     cb(new Error('Connection closed while downloading tarball file'))
    }
   })
origin: MT-Libraries/MT-Notes

request.get(remoteUrl)
      .on('response', function (response) {
        console.log('#ON:', response.statusCode, response.headers['content-type']);
      })
      .on('err', function (err) {
        console.log('#ERR ', err);
      })
      .pipe(writeStream)
      .on('end', function () {
        return result;
      });
origin: nayrnet/node-dahua-api

client.on('error', function(err) {
   handleDahuaEventError(self, err);
  });
request(npm)Requeston

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

  • commander
    the complete solution for node.js command-line programs
  • express
    Fast, unopinionated, minimalist web framework
  • aws-sdk
    AWS SDK for JavaScript
  • request
    Simplified HTTP request client.
  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • lodash
    Lodash modular utilities.
  • body-parser
    Node.js body parsing middleware
  • webpack
    Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
  • mkdirp
    Recursively mkdir, like `mkdir -p`
  • Top Sublime Text plugins
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