npm / npm-registry-client

http://npm.im/npm-registry-client
ISC License
264 stars 108 forks source link

Responses are not filtered as promised #153

Open medikoo opened 7 years ago

medikoo commented 7 years ago

At https://github.com/npm/npm-registry-client#requests is indicated that special header is added, so resolved meta-data is light.

It seems to be not the case now (v8.1.0), following:

var RegClient = require('npm-registry-client')
var client = new RegClient()
var uri = "https://registry.npmjs.org/npm"
var params = { timeout: 1000 }

client.get(uri, params, function (error, data, raw, res) {
    if (error) throw error;
    console.log("Versions count", Object.keys(data.versions).length);
    console.log("JSON Size", raw.length);
});

Outputs:

info attempt registry request try #1 at 4:06:18 PM
http request GET https://registry.npmjs.org/npm
http 200 https://registry.npmjs.org/npm
Versions count 256
JSON Size 6252157

This however might be registry issue, as indeed the header does not seem to have expected effect. I reported it here: https://github.com/npm/registry/issues/147

zkat commented 7 years ago

@medikoo you need fullMetadata: true in your params.

medikoo commented 7 years ago

@zkat this doesn't change anything, also I would suspect that fullMetadata: true will force not filtered response. While here issue is that not filtered response is returned by default, and I don't see a way to receive a filtered response.