# @cumulus/pvl

> Parse and serialize Parameter Value Language, a data markup language used by NASA

Latest version **22.4.0** (published 2026-09-02) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @cumulus/pvl
pnpm add @cumulus/pvl
yarn add @cumulus/pvl
bun add @cumulus/pvl
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 22.4.0 |
| Published | 2026-09-02 |
| First published | 2018-01-11 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 304 |
| Author | Cumulus Authors |
| Maintainers | cumuluspublisher, nsidc_kovarik, jennyhliu, npauzenga, ppilone84, etcart |
| Keywords | odl, pvl, parameter value language, object description language |

## Links

- npm: https://www.npmjs.com/package/@cumulus/pvl
- Repository: https://github.com/nasa/cumulus
- Homepage: https://github.com/nasa/cumulus/tree/master/packages/pvl
- Issues: https://github.com/nasa/cumulus/issues
- npm.io page: https://npm.io/package/@cumulus/pvl

## Recent versions

- 22.4.0 (latest) — 2026-09-02
- 21.3.5 (release-v21.3.5) — 2026-06-03
- 20.3.3 (release-v20.3.3) — 2026-04-16
- 21.2.1 (release-v21.2.1) — 2026-03-18
- 21.3.2-testlerna.0 (release-v21.3.2-testlerna.0) — 2026-03-02
- 21.3.1-alpha.0 (release-v21.3.1-alpha.0) — 2026-01-28
- 20.3.2 (release-v20.3.2) — 2025-12-04
- 20.2.3 (release-v20.2.3) — 2025-12-03
- 21.0.0-echo10 (release-v21.0.0-echo10) — 2025-11-21
- 20.3.1 (release-v20.3.1) — 2025-10-14
- 20.2.2 (release-v20.2.2) — 2025-10-08
- 20.1.3-alpha.2 (release-v20.1.3-alpha.2) — 2025-05-15
- 20.1.3-alpha.1 (release-v20.1.3-alpha.1) — 2025-05-15
- 20.1.3-alpha.0 (release-v20.1.3-alpha.0) — 2025-05-14
- 18.5.6 (release-v18.5.6) — 2025-04-11
- … 246 more at https://npm.io/package/@cumulus/pvl/versions

## README

# @cumulus/pvl

## About Cumulus

Cumulus is a cloud-based data ingest, archive, distribution and management prototype for NASA's future Earth science data streams.

[Cumulus Documentation](https://nasa.github.io/cumulus)

## PVL

A JS module to parse and serialize Parameter Value Language, a data markup language used by NASA.

### How-to

#### Parse

```js
> const pvl = require('./pvl/index.js')

> const input = (`
ORIGINATING_SYSTEM = "ASTER_FTP";
OBJECT = "FILE_GROUP";
    DATA_TYPE = "AST_L1A";
    OBJECT = "FILE_SPEC";
        FILE_ID = "pg-PR1A0000-2017040601_000_001";
        FILE_TYPE = "SCIENCE";
        FILE_SIZE = 116503123;
    END_OBJECT = "FILE_SPEC";
    OBJECT = "FILE_SPEC";
        FILE_ID = "pg-BR1A0000-2017040601_000_001";
        FILE_TYPE = "BROWSE";
        FILE_SIZE = 166428;
    END_OBJECT = "FILE_SPEC";
END_OBJECT = "FILE_GROUP"
`)

> const parsed = pvl.pvlToJS(input)

> parsed
PVLRoot {
  store: [ [ 'ORIGINATING_SYSTEM', [Object] ], [ 'OBJECT', [Object] ] ],
  type: 'ROOT',
  depth: 0 }

> JSON.stringify(parsed)
'{"store":[["ORIGINATING_SYSTEM",{"value":"ASTER_FTP","type":"text string"}],["OBJECT",{"store":[["DATA_TYPE",{"value":"AST_L1A","type":"text string"}],["OBJECT",{"store":[["FILE_ID",{"value":"pg-PR1A0000-2017040601_000_001","type":"text string"}],["FILE_TYPE",{"value":"SCIENCE","type":"text string"}],["FILE_SIZE",{"value":116503123,"type":"numeric"}]],"identifier":"FILE_SPEC","type":"OBJECT"}],["OBJECT",{"store":[["FILE_ID",{"value":"pg-BR1A0000-2017040601_000_001","type":"text string"}],["FILE_TYPE",{"value":"BROWSE","type":"text string"}],["FILE_SIZE",{"value":166428,"type":"numeric"}]],"identifier":"FILE_SPEC","type":"OBJECT"}]],"identifier":"FILE_GROUP","type":"OBJECT"}]],"type":"ROOT","depth":0}'
```

#### Serialize

```js
...
> const serialized = pvl.jsToPVL(parsed)

> console.log(serialized)
ORIGINATING_SYSTEM = "ASTER_FTP";
OBJECT = FILE_GROUP;
  DATA_TYPE = "AST_L1A";
  OBJECT = FILE_SPEC;
    FILE_ID = "pg-PR1A0000-2017040601_000_001";
    FILE_TYPE = "SCIENCE";
    FILE_SIZE = 116503123;
  END_OBJECT = FILE_SPEC;
  OBJECT = FILE_SPEC;
    FILE_ID = "pg-BR1A0000-2017040601_000_001";
    FILE_TYPE = "BROWSE";
    FILE_SIZE = 166428;
  END_OBJECT = FILE_SPEC;
END_OBJECT = FILE_GROUP;

```

#### Traverse the object and get values

```js
...
> parsed.get('ORIGINATING_SYSTEM')  // Get the item with the given key
PVLTextString { value: 'ASTER_FTP', type: 'text string' }

> parsed.get('ORIGINATING_SYSTEM').value  // Access its value
'ASTER_FTP'

> parsed.getAll('ORIGINATING_SYSTEM')  // Since PVL allows duplicate keys
[ PVLTextString { value: 'ASTER_FTP', type: 'text string' } ]

> parsed.aggregates()  // Get all OBJECTs and GROUPs
[ PVLObject {
    store: [ [Object], [Object], [Object] ],
    identifier: 'FILE_GROUP',
    type: 'OBJECT' } ]

> parsed.objects()  // Get all OBJECTs
[ PVLObject {
    store: [ [Object], [Object], [Object] ],
    identifier: 'FILE_GROUP',
    type: 'OBJECT' } ]

> parsed.objects('FILE_GROUP')  // Get all OBJECTs with a given name
[ PVLObject {
    store: [ [Object], [Object], [Object] ],
    identifier: 'FILE_GROUP',
    type: 'OBJECT' } ]

> parsed.aggregates()[0].aggregates()[1].get('FILE_ID').value  // Dig deep
'pg-BR1A0000-2017040601_000_001'
```

#### Roll your own

```js
...
> const PVLRoot = pvl.models.PVLRoot
> const PVLTextString = pvl.models.PVLTextString
> const PVLGroup = pvl.models.PVLGroup

> const simple = new PVLRoot().add('FOO', new PVLTextString('BAR')).add('BAZ', new PVLTextString('QUX'))

> simple
PVLRoot {
  store: [ [ 'FOO', [Object] ], [ 'BAZ', [Object] ] ],
  type: 'ROOT',
  depth: 0 }

> console.log(pvl.jsToPVL(simple))
FOO = "BAR";
BAZ = "QUX";

> const complex = new PVLRoot().addAggregate(new PVLGroup('FOO').add('BAR', new PVLTextString('BAZ'))).addAggregate(new PVLGroup('QUX').add('BAR', new PVLTextString('FIZZ')))

> complex
PVLRoot {
  store: [ [ 'GROUP', [Object] ], [ 'GROUP', [Object] ] ],
  type: 'ROOT',
  depth: 0 }

> console.log(pvl.jsToPVL(complex))
GROUP = FOO;
  BAR = "BAZ";
END_GROUP = FOO;
GROUP = QUX;
  BAR = "FIZZ";
END_GROUP = QUX;

```

### Tests

Run tests with `npm test`.

### Language specs

- [Spec for PVL](https://pirlwww.lpl.arizona.edu/software/PPVL/CCSDS-641.0-B-2.pdf)
- [Tutorial for PVL](https://public.ccsds.org/Pubs/641x0g2.pdf)

## Contributing

To make a contribution, please [see our contributing guidelines](https://github.com/nasa/cumulus/blob/master/CONTRIBUTING.md).

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