npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ezpaarse-project/ezmesure

v3.0.0

Published

a wrapper around ezmesure API

Downloads

63

Readme

node-ezmesure

A NodeJS wrapper around ezMESURE API.

Installation

npm install -g @ezpaarse-project/ezmesure

Command line usage

The module provides an ezmesure command (aliased ezm).

Global options

| Name | Type | Description | | --- | --- | --- | | -u, --base-url | String | API URL (ex: https://ezmesure-preprod.couperin.org/api) | | -t, --token | String | The auth token to use | | -k, --insecure | String | Allow connections to SSL without certs | | -m, --timeout | Number | Request timeout in milliseconds | | --version | Boolean | Print the version number | | --help | Boolean | Show some help |

You can get help for any command by typing ezmesure <command> help.

When using node-ezmesure on the command line, any .ezmesurerc file located in the current directory or any of its parents will be used as default

ezmesure indices list

List available indices

ezmesure indices delete <index>

Delete <index>

ezmesure indices insert <index> <files..>

Insert <files> into an <index>. Directories are also supported, in which case all files matching --ext are inserted.

Options

| Name | Type | Description | | --- | --- | --- | | -z, --gunzip | String | Uncompress Gzip files locally | | -n, --no-store | String | Disable storing uploaded data in your online space | | -s, --split | String | Split a multivalued field. Format: "fieldname(delimitor)" | | -r, --recursive | Boolean | Look for files in subdirectories | | --ext | String | Specify file extensions - default: .csv,.csv.gz |

Examples

  # Insert CSV files from ezpaarse-results into univ-foobar
  ezmesure indices insert univ-foobar ezpaarse-results/*.csv

ezmesure metrics

Get overall metrics from the API

ezmesure events delete <index>

Delete consultation events from <index>

Options

| Name | Type | Description | | --- | --- | --- | | --from | String | Minimum date of the events that should be removed. Can be either a date or datetime in ISO format. | | --to | String | Maximum date of the events that should be removed. Can be either a date or datetime in ISO format. |

Examples

  # Remove consultations from univ-foobar in 2018
  ezmesure events delete univ-foobar --from 2018-01-01T00:00:00 --to 2019-01-01T00:00:00

ezmesure tops <index>

Give top metrics for a given <index>

Options

| Name | Type | Description | | --- | --- | --- | | -s, --size | Number | Size of the tops | | -p, --period | String | Period of the tops. Possible values: today, yesterday, current_week, last_week, current_month, last_month, current_year, last_year, all (default) |

Examples

  # Get a top 10 for the last month
  ezmesure tops univ-foo -s 10 -p last_month
  
  # Get a top 3 for the whole index
  ezmesure tops univ-foo -s 10 -p all

ezmesure depositors refresh

Refresh the depositors list

Module

Usage

const ezmesure = require('ezmesure');

ezmesure.indices.list().then(indiceList => {
  console.log(indiceList);
}).catch(err => {
  console.error(err);
});

Global options

| Name | Type | Description | | --- | --- | --- | | baseUrl | String | URL to the API endpoint (ex: https://ezmesure.couperin.org/api) | | token | String | JWT auth token | | strictSSL | Boolean | enable or disable SSL cert verification | | headers | Object | custom headers to send along with the request |

Methods

indices.list([{Object} options]) : Promise

Returns an array of all indices with their name and the number of documents.

Example of result:

[
  { name: 'univ-fcomte', docs: 35133 },
  { name: 'univ-test2', docs: 31923 },
  { name: 'univ-test3', docs: 15 }
]

indices.insert({String|Stream} file, {String} index[, {Object} options]) : Promise

Inserts a file (given either a path or a readable stream) into an indice. Returns an object with the following properties:

  • inserted: number of documents successfuly inserted.
  • updated: number of documents successfuly updated.
  • failed: number of documents that failed to be inserted.
  • errors: an array containing the 10 first errors generated during the insertion.

indices.delete({String} index[, {Object} options]) : Promise

Deletes an indice. Returns an object with the following property:

  • acknowledged: boolean, will be true in case of success, false otherwise.

indices.metrics([{Object} options]) : Promise

Returns an array of all indices with their name and the number of documents.

Example of result:

{
  "took": 148,
  "docs": 344381732,
  "dateCoverage": {
    "min": 1375225410000,
    "max": 1542326387000
  },
  "metrics": {
    "days": 1935,
    "titles": 1730487,
    "platforms": 173,
    "indices": 86
  }
}

indices.tops({String} index[, {Object} options]) : Promise

Returns an array of all indices with their name and the number of documents.

Options

| Name | Type | Description | | --- | --- | --- | | size | Number | Size of the tops | | period | String | Period of the tops. Possible values: today, yesterday, current_week, last_week, current_month, last_month, current_year, last_year, all (default) |

Example of result:

{
  "took": 847,
  "docs": 3411691,
  "dateCoverage": {
    "min": 1483225472000,
    "max": 1542322684000
  },
  "tops": {
    "titles": [
      {
        "key": "Organometallics",
        "doc_count": 45174
      }
    ],
    "publishers": [
      {
        "key": "Steinkopff",
        "doc_count": 1146437
      }
    ],
    "indices": [
      {
        "key": "univ-foobar",
        "doc_count": 3411691
      }
    ]
  }
}

events.delete({String} index[, {Object} options]) : Promise

Remove consultation events from an index.

Options

| Name | Type | Description | | --- | --- | --- | | from | String | Minimum date of the events that should be removed. Can be either a date or datetime in ISO format. | | to | String | Maximum date of the events that should be removed. Can be either a date or datetime in ISO format. |

depositors.refresh([{Object} options]) : Promise

Refresh the depositor list and return an array of all indices with their name and the number of documents.

Example of result:

[
  { name: 'University of Foobar', prefix: 'univ-foobar', count: 35133, result: 'created' },
  { name: 'University of Barfoo', prefix: 'univ-barfoo', count: 31923, result: 'created' }
]

config.find([{String} startPath]) : Promise

Looks for a .ezmesurerc file in the given directory (defaulting to the working directory) and all its parents. Returns the path of the config file, or null if not found.

config.load({String|Object} config) : Promise

Loads a default config, using either an object or a path to a config file.