/csw-client

A very simple CSW client

Primary LanguageJavaScriptMIT LicenseMIT

csw-client CircleCI

A very simple CSW client

npm version dependencies Status codecov XO code style

Prerequisite

Features

  • Fetch capabilities
  • Fetch records
  • Harvest (w/ Stream API)
  • Support ISO 19139 (including Inspire profile)
  • Support Dublin Core

Installation

npm install csw-client

Usage

Create a client

const csw = require('csw-client');
const client = csw('http://your-csw-server.tld/csw', options);

Options

Name Description Type Default value
userAgent User-Agent string you want to use in requests string "CSWBot"
gzip enable compression boolean true
timeout requests will fail after X ms integer disabled

Harvest

Stream API

client.harvest(options).pipe(outputStream);

Alternative

client.harvest(options)
    .on('record', record => console.log(record.type))
    .on('error', err => console.error(err))
    .on('end', () => console.log('Finished!'))
    .resume();

Options

Name Description Type Default value
step number of records asked by GetRecords request integer 20
concurrency number of concurrent GetRecords requests integer 5

Events

Name Description Properties
record a new record is found type: record type
body: parsed value
started harvesting has started none
failed harvesting has failed none
end harvesting has ended none