# @internetarchive/metadata-service

> A service for fetching metadata about items in the Internet Archive

Latest version **1.1.0** (published 2026-07-27) · AGPL-3.0-only license · 0 weekly downloads

## Install

```sh
npm install @internetarchive/metadata-service
pnpm add @internetarchive/metadata-service
yarn add @internetarchive/metadata-service
bun add @internetarchive/metadata-service
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2026-07-27 |
| First published | 2022-09-01 |
| Weekly downloads | 0 |
| License | AGPL-3.0-only |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 176.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | bfalling, mitraardron, vbanos, kngenie, iisa, cdrini, nsharma123, dualcnhq, latonv, ibnesayeed, tracey.pooh, jim-at-ia, jeffwklein, rebecca-shoptaw, jbuckner, dhallia |

## Links

- npm: https://www.npmjs.com/package/@internetarchive/metadata-service
- npm.io page: https://npm.io/package/@internetarchive/metadata-service

## Dependencies (4)

- [typescript-memoize](https://npm.io/package/typescript-memoize.md) ^1.1.1
- [@internetarchive/result-type](https://npm.io/package/@internetarchive/result-type.md) ^0.0.1
- [@internetarchive/field-parsers](https://npm.io/package/@internetarchive/field-parsers.md) ^0.1.4
- [@internetarchive/iaux-item-metadata](https://npm.io/package/@internetarchive/iaux-item-metadata.md) ^1.3.0

## Recent versions

- 1.1.0 (latest) — 2026-07-27
- 1.0.5-webdev-7743.0 (canary) — 2025-09-23
- 1.0.4-webdev-7436.0 (alpha) — 2025-04-21
- 1.0.6 — 2026-05-28
- 1.0.5 — 2025-09-25
- 1.0.5-alpha1 — 2025-07-25
- 1.0.4 — 2025-04-21
- 1.0.3 — 2025-01-16
- 1.0.2 — 2025-01-16
- 1.0.1 — 2025-01-16
- 1.0.0 — 2025-01-15
- 0.1.1 — 2024-10-03
- 0.0.0-bc6513-0 — 2024-07-08
- 0.1.0 — 2022-09-22
- 0.0.1-alpha.1 — 2022-09-01

## README

# Internet Archive Metadata Service

A service for retrieving metadata about items in the Internet Archive.

## Installation
```bash
npm install @internetarchive/metadata-service
```

## Usage

### Fetch Metadata

```ts
const metadataResponse: MetadataResponse = await metadataService.fetchMetadata('some-identifier');

metadataResponse.metadata.identifier // => 'some-identifier'
metadataResponse.metadata.collection.value // => 'some-collection'
metadataResponse.metadata.collection.values // => ['some-collection', 'another-collection', 'more-collections']
```

## Metadata Values

Internet Archive Metadata is expansive and nearly all metadata fields can be returned as either an array, string, or number.

The Metadata Service handles all of the possible variations in data formats and converts them to their appropriate types. For instance on date fields, like `date`, it takes the string returned and converts it into a native javascript `Date` value. Similarly for duration-type fields, like `length`, it takes the duration, which can be seconds `324.34` or `hh:mm:ss.ms` and converts them to a `number` in seconds.

There are parsers for several different field types, like `Number`, `String`, `Date`, and `Duration` and others can be added for other field types.

See `src/models/metadata-fields/field-types.ts`

### Usage

```ts
metadata.collection.value // return just the first item of the `values` array, ie. 'my-collection'
metadata.collection.values // returns all values of the array, ie. ['my-collection', 'other-collection']
metadata.collection.rawValue // return the rawValue. This is useful for inspecting the raw response received.

metadata.date.value  // return the date as a javascript `Date` object

metadata.length.value  // return the length (duration) of the item as a number of seconds, can be in the format "hh:mm:ss" or decimal seconds
```

# Development

## Prerequisite
```bash
npm install
```

## Testing
```bash
npm run test
```

## Demo
```bash
npm run start
```

## Linting
```bash
npm run format
```

---
_Source: https://npm.io/package/@internetarchive/metadata-service · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
