Skip to content

Commit

Permalink
Merge pull request #18 from paperhive/feature/improve-readme
Browse files Browse the repository at this point in the history
Readme: improve example
  • Loading branch information
andrenarchy authored Jun 22, 2018
2 parents c5d14de + c3768a3 commit 5a0dc4c
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `oai-example.js` with `node -r esm oai-example.js`:

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)
Expand Down

0 comments on commit 5a0dc4c

Please sign in to comment.