🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

plist

Package Overview
Dependencies
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

plist

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

Source
npmnpm
Version
4.0.0
Version published
Weekly downloads
16M
5.05%
Maintainers
2
Weekly downloads
 
Created
Source

plist.js

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

ci

Provides facilities for reading and writing Plist (property list) files. These are often used in programming OS X and iOS applications, as well as the iTunes configuration XML file.

Plist files represent stored programming "object"s. They are very similar to JSON. A valid Plist file is representable as a native JavaScript Object and vice-versa.

Usage

Node.js

Install using npm:

$ npm install plist

Then import the parse() and build() functions:

import { parse, build } from 'plist';

const val = parse('<plist><string>Hello World!</string></plist>');
console.log(val);  // "Hello World!"

Browser

Use an import map to resolve the bare module specifiers used by plist and its dependencies, then import directly from the source:

<script type="importmap">
  {
    "imports": {
      "@xmldom/xmldom": "https://esm.sh/@xmldom/xmldom",
      "xmlbuilder": "https://esm.sh/xmlbuilder"
    }
  }
</script>
<script type="module">
  import { parse, build } from './node_modules/plist/index.js';

  const val = parse('<plist><string>Hello World!</string></plist>');
  console.log(val);  // "Hello World!"
</script>

See the browser example for a drag-and-drop demo.

API

Parsing

Parsing a plist from filename:

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

const obj = parse(readFileSync('myPlist.plist', 'utf8'));
console.log(JSON.stringify(obj));

Parsing a plist from string payload:

import { parse } from 'plist';

const 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">' +
    '<key>metadata</key>' +
    '<dict>' +
      '<key>bundle-identifier</key>' +
      '<string>com.company.app</string>' +
      '<key>bundle-version</key>' +
      '<string>0.1.1</string>' +
      '<key>kind</key>' +
      '<string>software</string>' +
      '<key>title</key>' +
      '<string>AppName</string>' +
    '</dict>' +
  '</plist>';

console.log(parse(xml));

// [
//   "metadata",
//   {
//     "bundle-identifier": "com.company.app",
//     "bundle-version": "0.1.1",
//     "kind": "software",
//     "title": "AppName"
//   }
// ]

Building

Given an existing JavaScript Object, you can turn it into an XML document that complies with the plist DTD:

import { build } from 'plist';

const obj = [
  "metadata",
  {
    "bundle-identifier": "com.company.app",
    "bundle-version": "0.1.1",
    "kind": "software",
    "title": "AppName"
  }
];

console.log(build(obj));

// <?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">
//   <key>metadata</key>
//   <dict>
//     <key>bundle-identifier</key>
//     <string>com.company.app</string>
//     <key>bundle-version</key>
//     <string>0.1.1</string>
//     <key>kind</key>
//     <string>software</string>
//     <key>title</key>
//     <string>AppName</string>
//   </dict>
// </plist>

License

(The MIT License)

Keywords

apple

FAQs

Package last updated on 25 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts