v0.5.3
Deno and Node.js API module for OAI-PMH.
Attributes
Includes Deno configuration
Repository
Current version released
2 years ago
Dependencies
deno.land/x
What is this?
It’s a “blazingly fast” OAI-PMH Version 2.0 API client module for Node.js and Deno.
Install for Node.js
npm i oai_pmh_v2
Note For Node.js users this is an ESM only module. Read more here and maybe here.
Example
// Node.js
import { OAIPMH, OAIPMHParser } from "oai_pmh_v2";
// Deno
import {
OAIPMH,
OAIPMHParser,
} from "https://deno.land/x/oai_pmh_v2/src/mod.ts";
// You can find OAI-PMH providers here (although a lot of them might be non functional):
// https://www.openarchives.org/Register/BrowseSites
const oaiPmh = new OAIPMH({
baseUrl:
"http://bibliotecavirtual.asturias.es/i18n/oai/oai_bibliotecavirtual.asturias.es.cmd",
});
const info = await oaiPmh.identify({ signal: AbortSignal.timeout(20000) });
console.log(info);
for await (
const records of oaiPmh.listRecords<
{
Define: "the structure of";
your: "records";
like: { so: "!"; Otherwise: { "they're of type": [unknown, "."] } };
"Don't": "forget that arrays with single elements won't be arrays"[];
due: { to: "the way xml works, so you'll always have to check!" };
}
>(
{ metadataPrefix: "marc21" },
{ signal: AbortSignal.timeout(17000) },
)
) {
console.log(records);
}
Find examples for all methods in examples directory. Some things are only documented via types for now.