# plist

> Apple's property list parser/builder for Node.js and browsers

Latest version **5.0.0** (published 2026-05-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install plist
pnpm add plist
yarn add plist
bun add plist
```

## Health

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

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2026-05-03 |
| First published | 2011-05-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 2 |
| Unpacked size | 98.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 607 |
| Author | Nathan Rajlich |
| Maintainers | tootallnate |
| Keywords | apple, browser, mac, plist, parser, xml |

## Links

- npm: https://www.npmjs.com/package/plist
- Repository: https://github.com/TooTallNate/plist.js
- Homepage: https://github.com/TooTallNate/plist.js#readme
- Issues: https://github.com/TooTallNate/plist.js/issues
- npm.io page: https://npm.io/package/plist

## Dependencies (2)

- [xmlbuilder](https://npm.io/package/xmlbuilder.md) ^15.1.1
- [@xmldom/xmldom](https://npm.io/package/@xmldom/xmldom.md) ^0.9.10

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 5.0.0 (latest) — 2026-05-03
- 4.0.0 — 2026-04-25
- 3.1.1 — 2026-04-25
- 3.1.0 — 2023-07-06
- 3.0.6 — 2022-07-12
- 3.0.5 — 2022-03-23
- 3.0.4 — 2021-08-27
- 3.0.3 — 2021-08-04
- 3.0.2 — 2021-03-26
- 3.0.1 — 2018-03-21
- 3.0.0 — 2018-03-18
- 2.1.0 — 2017-05-04
- 2.0.1 — 2016-08-16
- 2.0.0 — 2016-08-16
- 1.2.0 — 2015-11-10
- … 14 more at https://npm.io/package/plist/versions

## README

# plist.js

Apple property list parser/builder for Node.js and browsers. Supports **XML**, **binary** (bplist00), and **OpenStep** formats.

[![CI](https://github.com/TooTallNate/plist.js/actions/workflows/ci.yml/badge.svg)](https://github.com/TooTallNate/plist.js/actions/workflows/ci.yml)
[![npm](https://img.shields.io/npm/v/plist)](https://www.npmjs.com/package/plist)
[![npm bundle size](https://img.shields.io/bundlephobia/minzip/plist)](https://bundlephobia.com/package/plist)

**[Try it in the browser →](https://plist.n8.io/)**

## Features

- **Parse** XML, binary, and OpenStep plists — format is auto-detected
- **Build** XML and binary plists from JavaScript objects
- **TypeScript** — written in TypeScript with full type declarations
- **Browser-optimized** — uses native `DOMParser` in browsers (zero dependencies)
- **Lightweight** — ~4 KB gzipped in the browser

## Install

```bash
npm install plist
```

## Quick Start

```ts
import { parse, build } from 'plist';

// Parse any plist format (auto-detected)
const obj = parse('<plist version="1.0"><string>Hello!</string></plist>');
console.log(obj); // "Hello!"

// Build an XML plist from a JS object
const xml = build({ name: 'My App', version: 42 });
console.log(xml);
```

## Parsing

### XML Plists

```ts
import { readFileSync } from 'node:fs';
import { parse } from 'plist';

const xml = readFileSync('Info.plist', 'utf8');
const obj = parse(xml);
```

### Binary Plists

Binary plists (bplist00) are auto-detected when passed as a `Uint8Array` or `ArrayBuffer`. You can also use `parseBinary()` directly:

```ts
import { readFileSync } from 'node:fs';
import { parse, parseBinary } from 'plist';

// Auto-detected from binary data
const buf = readFileSync('Info.plist');
const obj = parse(new Uint8Array(buf));

// Or use parseBinary() directly
const obj2 = parseBinary(new Uint8Array(buf));
```

### OpenStep Plists

The old-style ASCII format (used by `defaults read` on macOS) is auto-detected when the input starts with `{` or `(`:

```ts
import { parse, parseOpenStep } from 'plist';

// Auto-detected
const obj = parse('{ CFBundleName = "My App"; CFBundleVersion = 42; }');

// Or use parseOpenStep() directly
const obj2 = parseOpenStep('( item1, item2, item3 )');
```

## Building

### XML Output

```ts
import { build } from 'plist';

const xml = build({
  CFBundleName: 'My App',
  CFBundleVersion: '1.0',
  LSRequiresIPhoneOS: true,
  UISupportedInterfaceOrientations: [
    'UIInterfaceOrientationPortrait',
    'UIInterfaceOrientationLandscapeLeft',
  ],
});
```

Output:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>CFBundleName</key>
    <string>My App</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UISupportedInterfaceOrientations</key>
    <array>
      <string>UIInterfaceOrientationPortrait</string>
      <string>UIInterfaceOrientationLandscapeLeft</string>
    </array>
  </dict>
</plist>
```

### Binary Output

```ts
import { writeFileSync } from 'node:fs';
import { buildBinary } from 'plist';

const data = buildBinary({
  CFBundleName: 'My App',
  CFBundleVersion: '1.0',
});

writeFileSync('Info.plist', data);
```

## Type Mapping

| Plist Type | JavaScript Type |
|---|---|
| `<string>` | `string` |
| `<integer>` | `number` |
| `<real>` | `number` |
| `<true/>` / `<false/>` | `boolean` |
| `<date>` | `Date` |
| `<data>` | `Uint8Array` |
| `<array>` | `Array` |
| `<dict>` | `Object` |

## Browser Usage

In bundled applications (Vite, webpack, etc.), just import normally — the browser-optimized build is selected automatically via [conditional exports](https://nodejs.org/api/packages.html#conditional-exports):

```ts
import { parse, build } from 'plist';
```

The browser build uses native `DOMParser` and string-based XML building, so `@xmldom/xmldom` and `xmlbuilder` are not included in the bundle.

**[Try the interactive playground →](https://plist.n8.io/)**

## API

### `parse(input)`

Parse a plist. Format is auto-detected.

- **input**: `string | Uint8Array | ArrayBuffer`
- **returns**: `PlistValue`

### `parseBinary(data)`

Parse a binary plist (bplist00).

- **data**: `Uint8Array`
- **returns**: `PlistValue`

### `parseOpenStep(input)`

Parse an OpenStep/ASCII plist.

- **input**: `string`
- **returns**: `PlistValue`

### `build(obj, opts?)`

Build an XML plist string.

- **obj**: `PlistValue`
- **opts.pretty**: `boolean` (default: `true`) — pretty-print with indentation
- **opts.indent**: `string` (default: `"  "`) — indentation string
- **opts.newline**: `string` (default: `"\n"`) — newline string
- **returns**: `string`

### `buildBinary(obj)`

Build a binary plist (bplist00).

- **obj**: `PlistValue`
- **returns**: `Uint8Array`

### `PlistValue`

```ts
type PlistValue =
  | string
  | number
  | boolean
  | Date
  | Uint8Array
  | PlistValue[]
  | { [key: string]: PlistValue }
  | null;
```

## License

[MIT](LICENSE)

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