From e77211db2ac58a4c541ae388d99c4aed096102b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gaul?= Date: Fri, 22 Jun 2018 16:04:33 +0200 Subject: [PATCH 1/2] README: update example --- README.md | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 53c2ffc..c9cfbba 100644 --- a/README.md +++ b/README.md @@ -10,17 +10,30 @@ A nodejs module for the Open Archives Initiative Protocol for Metadata Harvestin npm install oai-pmh ``` +**Note:** Node >= 10 is required for this module. + # Library ## Example -```javascript -import { OaiPmh } from 'oai-pmh'; +You can run the following script with `node -r esm`: -const oaiPmh = new OaiPmh('http://export.arxiv.org/oai2'); -for await (const identifier of oaiPmh.listIdentifiers({from: '2017-11-01'})) { - // do something with identifier +```javascript +import { OaiPmh } from 'oai-pmh' + +async function main () { + const oaiPmh = new OaiPmh('http://export.arxiv.org/oai2') + const identifierIterator = oaiPmh.listIdentifiers({ + metadataPrefix: 'oai_dc', + from: '2015-01-01', + until: '2015-01-04' + }) + for await (const identifier of identifierIterator) { + console.log(identifier) + } } + +main().catch(console.error) ``` See [OaiPmh in oai-pmh.js](https://github.com/paperhive/oai-pmh/blob/master/src/oai-pmh.js) From c3768a313c866782593c30de6789914cfac1248f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gaul?= Date: Fri, 22 Jun 2018 16:05:42 +0200 Subject: [PATCH 2/2] README: specify filename in example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c9cfbba..4f2e486 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ npm install oai-pmh ## Example -You can run the following script with `node -r esm`: +You can run the following script `oai-example.js` with `node -r esm oai-example.js`: ```javascript import { OaiPmh } from 'oai-pmh'