Wrapper around the VIAF API for Node.
BETA - there's a lot of work to be done, I'm just getting this out here for now.
npm i viaf
See the "example" directory.
var viaf = require('viaf'); viaf.autosuggest(query, callback); viaf.read(id, callback); viaf.read(id, dataType, callback); viaf.search(query, callback);
The callback is passed three parameters in this order: any error that occurs, an HTTP response object, and the body (text) of the response. The
read method's default dataType is XML and its valid types are: html, xml, json (just returns a list of links to other authorities), rdf, json-ld, rss, marc21, marcxml, marchtml, unimarcxml, unimarchtml.
This is not meant to do much other than conveniently request & return data from VIAF, so among the tasks it won't perform: parse this data, provide an autocomplete widget, or provide a synchronous wrapper for operations. Look in the "example" folder to see how this package might be used to accomplish something actually useful.
Internally, this module uses request to call the VIAF API. You can pass options directly to request by overriding the
viaf.requestOptions object, which is passed directly to request.
CC0 Public Domain
To the extent possible under law, Eric Phetteplace has waived all copyright and related or neighboring rights to viaf-npm.