Fast PLIST Parser

0.1.3 · maintenance · verified Sun Apr 19

fast-plist is a JavaScript library designed for rapidly parsing Apple Property List (PLIST) files. Currently at version 0.1.3, this package has a very low release cadence, with its last update approximately three years ago. It focuses solely on parsing XML-formatted PLISTs efficiently, providing a straightforward API for converting PLIST XML strings into JavaScript objects. While it is maintained by Microsoft (suggesting reliability for its niche), its lack of recent updates means it may not incorporate the latest performance optimizations or features found in more actively developed PLIST parsing libraries, nor does it explicitly support binary PLIST formats. It ships with TypeScript type definitions, making it compatible with modern TypeScript projects, though its primary usage examples are CommonJS-based.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates parsing a well-formed XML PLIST string into a JavaScript object and handling errors for malformed input.

import { parse } from 'fast-plist';

const plistString = `
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
    <key>name</key>
    <string>Brogrammer</string>
    <key>settings</key>
    <dict>
        <key>background</key>
        <string>#1a1a1a</string>
        <key>caret</key>
        <string>#ecf0f1</string>
        <key>foreground</key>
        <string>#ecf0f1</string>
        <key>invisibles</key>
        <string>#F3FFB51A</string>
        <key>lineHighlight</key>
        <string>#2a2a2a</string>
    </dict>
</dict>
</plist>`;

try {
  const parsedData = parse(plistString);
  console.log(JSON.stringify(parsedData, null, 2));
} catch (error) {
  console.error('Failed to parse PLIST:', error.message);
}

// Example of parsing an invalid string (will throw an error)
try {
  parse(`bad string`);
} catch (error) {
  console.error('Error parsing bad string:', error.message);
}

view raw JSON →