"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm-registry-client/lib/ping.js" (8 Mar 2017, 659 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 module.exports = ping
    2 
    3 var url = require('url')
    4 var assert = require('assert')
    5 
    6 function ping (uri, params, cb) {
    7   assert(typeof uri === 'string', 'must pass registry URI to ping')
    8   assert(params && typeof params === 'object', 'must pass params to ping')
    9   assert(typeof cb === 'function', 'must pass callback to ping')
   10 
   11   var auth = params.auth
   12   assert(auth && typeof auth === 'object', 'must pass auth to ping')
   13 
   14   this.request(url.resolve(uri, '-/ping?write=true'), { auth: auth }, function (er, fullData) {
   15     if (er) {
   16       cb(er)
   17     } else if (fullData) {
   18       cb(null, fullData)
   19     } else {
   20       cb(new Error('No data received'))
   21     }
   22   })
   23 }