$62 GRAYBYTE WORDPRESS FILE MANAGER $80

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/opt/alt/alt-nodejs9/root/usr/lib/node_modules/npm/lib/search/

HOME
Current File : /opt/alt/alt-nodejs9/root/usr/lib/node_modules/npm/lib/search//esearch.js
'use strict'

var npm = require('../npm.js')
var log = require('npmlog')
var mapToRegistry = require('../utils/map-to-registry.js')
var jsonstream = require('JSONStream')
var ms = require('mississippi')
var gunzip = require('../utils/gunzip-maybe')

module.exports = esearch

function esearch (opts) {
  var stream = ms.through.obj()

  mapToRegistry('-/v1/search', npm.config, function (er, uri, auth) {
    if (er) return stream.emit('error', er)
    createResultStream(uri, auth, opts, function (err, resultStream) {
      if (err) return stream.emit('error', err)
      ms.pipeline.obj(resultStream, stream)
    })
  })
  return stream
}

function createResultStream (uri, auth, opts, cb) {
  log.verbose('esearch', 'creating remote entry stream')
  var params = {
    timeout: 600,
    follow: true,
    staleOk: true,
    auth: auth,
    streaming: true
  }
  var q = buildQuery(opts)
  npm.registry.request(uri + '?text=' + encodeURIComponent(q) + '&size=' + opts.limit, params, function (err, res) {
    if (err) return cb(err)
    log.silly('esearch', 'request stream opened, code:', res.statusCode)
    // NOTE - The stream returned by `request` seems to be very persnickety
    //        and this is almost a magic incantation to get it to work.
    //        Modify how `res` is used here at your own risk.
    var entryStream = ms.pipeline.obj(
      res,
      ms.through(function (chunk, enc, cb) {
        cb(null, chunk)
      }),
      gunzip(),
      jsonstream.parse('objects.*.package', function (data) {
        return {
          name: data.name,
          description: data.description,
          maintainers: data.maintainers,
          keywords: data.keywords,
          version: data.version,
          date: data.date ? new Date(data.date) : null
        }
      })
    )
    return cb(null, entryStream)
  })
}

function buildQuery (opts) {
  return opts.include.join(' ')
}


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
3 Mar 2024 10.42 PM
root / root
0755
all-package-metadata.js
11.641 KB
28 Sep 2021 11.28 AM
root / root
0644
all-package-search.js
1.525 KB
28 Sep 2021 11.28 AM
root / root
0644
esearch.js
1.859 KB
28 Sep 2021 11.28 AM
root / root
0644
format-package-stream.js
4.237 KB
28 Sep 2021 11.28 AM
root / root
0644
package-filter.js
1.156 KB
28 Sep 2021 11.28 AM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF