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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ezid

v1.0.1

Published

EzID API client

Readme

EzID.js — API client library for Node.js

Table of Contents

This JavaScript library provides a simple asynchronous interface to the EzID API (v2)

Current supports only ARK methods; DOI is not yet supported.

npm install ezid

API Reference

The asynchronous functions all return Promises.

EzID class

The EzID class is used to store credentials in order to avoid providing them with each request.

const EzID = require('ezid')
const client = new EzID ({ username: 'apitest', password: 'guess', shoulder: 'ark:/99999/fk4' })

EzID.get

Upstream documentation: https://ezid.cdlib.org/doc/apidoc.html#operation-get-identifier-metadata

This is a static function, since fetching metadata for an ARK does not require authentication.

EzID.get('ark:/48907/f3kd1xg1').then(res => {
  console.log(res)
})

Example output:

{ metadata:
   { _updated: '1477087454',
     _target: 'http://alexandria.ucsb.edu/lib/ark:/48907/f3kd1xg1',
     'erc.ark': 'ark:/48907/f3kd1xg1',
     'erc.when': '1910-1920',
     _export: 'yes',
     _owner: 'sb-adrl',
     _ownergroup: 'sb-library',
     _profile: 'erc',
     'erc.who': 'London, Arthur, 1880-1920',
     _created: '1460677598',
     _status: 'public',
     'erc.what': 'Arthur London / Gold Coast [Ghana] photograph collection' },
  id: 'ark:/48907/f3kd1xg1' }

EzID#mint

Requires authentication.

Upstream documentation: https://ezid.cdlib.org/doc/apidoc.html#operation-mint-identifier

The mint function creates an ARK with the specified metadata and an ID decided by the upstream EzID service.

const meta = {
  '_profile': 'erc',
  'erc.who': 'a bird'
}

client.mint(meta).then(res => {
  return console.log(res)
}).catch(err => {
  console.error(err)
})

Example output:

{ metadata: {}, id: 'ark:/99999/fk4mp67k1v' }

The HTTP response from EzID will include only the new ARK, not the metadata provided; the empty metadata hash returned by mint does not mean that the ARK was not minted correctly.

Ezid#create

Requires authentication.

Upstream documentation: https://ezid.cdlib.org/doc/apidoc.html#operation-create-identifier

The create function creates an ARK with the specified metadata and ID.

const obj = {
  id: 'ark:/99999/fk4/ucsbcreate',
  metadata: {
    '_profile': 'erc',
    'erc.who': 'a bird'
  }
}

client.create(obj).then(res => {
  return console.log(res)
}).catch(err => {
  console.error(err)
})

Example output:

{ metadata: {}, id: 'ark:/99999/fk4/ucsbcreate' }

The HTTP response from EzID will include only the new ARK, not the metadata provided; the empty metadata hash returned by create does not mean that the ARK was not minted correctly.

Ezid#update

Requires authentication.

Upstream documentation: https://ezid.cdlib.org/doc/apidoc.html#operation-update-identifier

The update function modifies the metadata of an existing ARK. Using a nonexisting ARK for the id will return an error.

const obj = {
  id: 'ark:/99999/fk4/ucsbcreate',
  metadata: {
    '_profile': 'erc',
    'erc.who': '',
    'erc.what': 'an example for the readme'
  }
}

client.update(obj).then(res => {
  return console.log(res)
}).catch(err => {
  console.error(err)
})

Example output:

{ metadata: {}, id: 'ark:/99999/fk4/ucsbcreate' }

The HTTP response from EzID will include only the ARK, not the updated metadata; the empty metadata hash returned by update does not mean that the ARK was not minted correctly.

Ezid#createOrUpdate

Requires authentication.

Upstream documentation: https://ezid.cdlib.org/doc/apidoc.html#operation-create-or-update-identifier

The createOrUpdate function either modifies the metadata of an existing ARK, or, if that ARK does not exist, creates it with the specified metadata.

const obj = {
  id: 'ark:/99999/fk4/ucsbcreate',
  metadata: {
    '_profile': 'erc',
    'erc.who': '',
    'erc.what': 'an example for the readme'
  }
}

client.update(obj).then(res => {
  return console.log(res)
}).catch(err => {
  console.error(err)
})

Example output:

{ metadata: {}, id: 'ark:/99999/fk4/ucsbcreate' }

The HTTP response from EzID will include only the ARK, not the metadata; the empty metadata hash returned by createOrUpdate does not mean that the ARK was not minted correctly.

Ezid#delete

Requires authentication.

Upstream documentation: https://ezid.cdlib.org/doc/apidoc.html#operation-delete-identifier

The delete function deletes an existing ARK owned by the authenticating user. ARKs can only be deleted when their _status is set to reserved.

// an object created with { '_status': 'reserved' }
client.delete('ark:/99999/fk4/ucsbres').then(res => {
  return console.log(res)
}).catch(err => {
  console.error(err)
})

Example output:

{ metadata: {}, id: 'ark:/99999/fk4/ucsbres' }

Developing

When running the tests, HTTP requests are mocked using Polly. To force a re-record of HTTP interactions, run with VCR_MODE=record npm test (defaults is replay).

Testing

Tests use replayer to play back HTTP requests. Use VCR_MODE=playback npm test to use existing fixtures, and VCR_MODE=record npm test to record new ones. For tests requiring authentication, set the environment variable EZID_PASS to the EzID test API password.