{"id":14572,"library":"fast-plist","title":"Fast PLIST Parser","description":"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.","status":"maintenance","version":"0.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/Microsoft/node-fast-plist","tags":["javascript","typescript"],"install":[{"cmd":"npm install fast-plist","lang":"bash","label":"npm"},{"cmd":"yarn add fast-plist","lang":"bash","label":"yarn"},{"cmd":"pnpm add fast-plist","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package's primary entry point is CommonJS. For ESM contexts, a named import like this should work via bundler or Node.js's interoperability layers. The `require` syntax directly accesses the `parse` function from the module's exports.","wrong":"const parse = require('fast-plist');","symbol":"parse","correct":"import { parse } from 'fast-plist';"}],"quickstart":{"code":"import { parse } from 'fast-plist';\n\nconst plistString = `\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<plist version=\"1.0\">\n<dict>\n    <key>name</key>\n    <string>Brogrammer</string>\n    <key>settings</key>\n    <dict>\n        <key>background</key>\n        <string>#1a1a1a</string>\n        <key>caret</key>\n        <string>#ecf0f1</string>\n        <key>foreground</key>\n        <string>#ecf0f1</string>\n        <key>invisibles</key>\n        <string>#F3FFB51A</string>\n        <key>lineHighlight</key>\n        <string>#2a2a2a</string>\n    </dict>\n</dict>\n</plist>`;\n\ntry {\n  const parsedData = parse(plistString);\n  console.log(JSON.stringify(parsedData, null, 2));\n} catch (error) {\n  console.error('Failed to parse PLIST:', error.message);\n}\n\n// Example of parsing an invalid string (will throw an error)\ntry {\n  parse(`bad string`);\n} catch (error) {\n  console.error('Error parsing bad string:', error.message);\n}","lang":"typescript","description":"Demonstrates parsing a well-formed XML PLIST string into a JavaScript object and handling errors for malformed input."},"warnings":[{"fix":"Thoroughly test in your target environment. Consider auditing the code or evaluating more actively maintained alternatives if security or compatibility with very recent runtimes is critical.","message":"The package version 0.1.3 is quite old (last published 3 years ago). This may lead to compatibility issues with newer Node.js versions or browser environments, and it might lack patches for potential security vulnerabilities discovered since its last release.","severity":"gotcha","affected_versions":"<=0.1.3"},{"fix":"For Node.js ESM projects, ensure your build setup correctly handles CommonJS dependencies. You might need to use dynamic `import()` or configure your bundler (e.g., Webpack, Rollup, esbuild) to resolve CommonJS modules. If using TypeScript, ensure your `tsconfig.json`'s `moduleResolution` is set appropriately (e.g., 'Bundler' or 'NodeNext').","message":"The package primarily exports CommonJS modules. When used in an ECMAScript Module (ESM) project, you might encounter `ERR_REQUIRE_ESM` errors, especially in Node.js environments without proper transpilation or direct ESM support for CommonJS modules. While bundlers often handle this, direct Node.js ESM execution might fail.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"If you need to work with binary PLISTs, consider using alternative libraries like `bplist-parser` or `@expo/plist` which offer support for both XML and binary formats.","message":"This library only supports XML-based PLIST parsing. It does not provide functionality for parsing or generating binary PLIST (`bplist`) files, which are often used by Apple for performance reasons. Attempting to parse a binary PLIST will result in a parsing error.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure the input string is a well-formed XML PLIST. The parser is strict and expects valid XML structure from the beginning.","cause":"Attempting to parse an input string that is not a valid XML-formatted PLIST.","error":"Error: Near offset X: expected < ~~~bad string~~~"},{"fix":"If in an ESM file, change `const parse = require('fast-plist').parse;` to `import { parse } from 'fast-plist';`. If this persists with bundlers, ensure your build configuration is set up to correctly handle CommonJS modules within an ESM project, or consider downgrading your module system to CommonJS if possible for the specific file.","cause":"You are trying to `require()` this CommonJS package within an ECMAScript Module (ESM) context in Node.js, and Node.js's interoperability could not handle it, or a bundler issue.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/project/node_modules/fast-plist/index.js from ... not supported"}],"ecosystem":"npm"}