"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm/lib/ping.js" (8 Mar 2017, 556 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 var npm = require('./npm.js')
    2 var output = require('./utils/output.js')
    3 
    4 module.exports = ping
    5 
    6 ping.usage = 'npm ping\nping registry'
    7 
    8 function ping (args, silent, cb) {
    9   if (typeof cb !== 'function') {
   10     cb = silent
   11     silent = false
   12   }
   13   var registry = npm.config.get('registry')
   14   if (!registry) return cb(new Error('no default registry set'))
   15   var auth = npm.config.getCredentialsByURI(registry)
   16 
   17   npm.registry.ping(registry, {auth: auth}, function (er, pong) {
   18     if (!silent) output(JSON.stringify(pong))
   19     cb(er, er ? null : pong)
   20   })
   21 }