@achingbrain/follow-registry
npm registry follower
Last updated a month ago by achingbrain .
BSD · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @achingbrain/follow-registry 
SYNC missed versions from official npm registry.

@achingbrain/follow-registry

Build Status Dependency Status

Follows the npm registry and yields change objects when new modules are published

Usage

const followRegistry = require('@achinbrain/follow-registry')

// All options are optional
const options = {
  // user agent used to request metadata etc
  ua: 'npm-registry-follower',

  // where to get the changes from
  replicator: 'https://replicate.npmjs.com/registry/_changes',

  // where to get module details from
  registry: 'https://registry.npmjs.com',

  // how many sets of metadata to request concurrently
  concurrency: 50,

  // restart the feed if no changes are received for this long
  inactivityTimeout: 3600000,

  // how long to wait after inactivityTimeout
  inactivityBackoff: 5000,

  // how many times to try fetching module metadata
  metadataRetries: 5,

  // how long to wait between retries
  metadataRetryBackoff: 5000,

  // override which seq value to start streaming changes from
  since: undefined,

  // override sequence file storage
  seq: {
    async read (), // returns a seq number
    async write (seq), // stores a seq number
    async reset () // resets the seq number
  }
}

for await (const { packument, seq, done } of followRegistry(options)) {
  //...do something with the change
  console.info(`${packument.name} was updated in seq ${seq}`)

  // signal we are done processing this change
  //
  // Important - if `done` is not called, the change will be
  // reprocessed the next time `followRegistry` is run
  await done()
}

// read the last sucessfully processed seq
const seq = await follow.seq(options)

// reset the last sucessfully processed seq
await follow.reset(options)

Changes feed

Objects returned from the feed are in the abbreviated format.

Acknowledgements

Forked from davglass/follow-registry.

Current Tags

  • 5.0.1                                ...           latest (a month ago)

9 Versions

  • 5.0.1                                ...           a month ago
  • 5.0.0                                ...           a month ago
  • 4.2.0                                ...           a month ago
  • 4.1.0                                ...           a month ago
  • 4.0.0                                ...           a month ago
  • 3.2.1                                ...           a year ago
  • 3.2.0                                ...           a year ago
  • 3.1.1                                ...           2 years ago
  • 3.1.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 9
Last Month 63
Dependencies (6)
Dev Dependencies (7)

Copyright 2014 - 2016 © taobao.org |