internetarchive-sdk-js
TypeScript icon, indicating that this package has built-in type declarations

1.0.17-beta • Public • Published

Internet Archive SDK for JavaScript

Version

NodeJS / Typescript SDK for Internet Archive APIs

Internet Archive APIs

https://archive.org/services/docs/api/

Install

Use npm to install the module

npm install internetarchive-sdk-js

Or use yarn to install the module

yarn add internetarchive-sdk-js

Usage

Get Items

import InternetArchive from 'internetarchive-sdk-js'
const ia = new InternetArchive()

;(async () => {
  const filters = {
    collection: 'library_of_congress',
    subject: 'basketball'
  }
  const options = {
    rows: 10,
    fields: 'identifier'
  }
  const items = await ia.getItems(filters, options)
  console.log(items.response.docs)
})()

Update Item (Requires "S3-Like API Key")

import InternetArchive from 'internetarchive-sdk-js'
const { API_KEY } = process.env || {}
const ia = new InternetArchive(API_KEY, { testmode: true })

;(async () => {
  const itemId = 'internetarchive-test-item-id'
  try {
    const response = await ia.updateItem(itemId, { title: 'new title' })
    console.log(response)
  } catch (error) {
    console.log(error.response.data)
  }
})()

Package Sidebar

Install

npm i internetarchive-sdk-js

Weekly Downloads

1

Version

1.0.17-beta

License

MIT

Unpacked Size

9.88 kB

Total Files

6

Last publish

Collaborators

  • mxwllstn