{"id":13778,"library":"plist","title":"plist","description":"The `plist` library provides robust facilities for parsing and building Apple Property List (Plist) files in both Node.js and browser environments. Plists are XML-based or binary structured data files commonly used in macOS and iOS applications, akin to JSON for configuration and data storage. The current stable version is 3.1.0, and it maintains an active development status with releases primarily driven by bug fixes, dependency updates, or feature enhancements. Key differentiators include its cross-platform compatibility, support for both XML and binary plist formats (implied by typical plist library functionality, though README focuses on XML), and its straightforward API for converting between JavaScript objects and plist XML strings. This package is an essential tool for developers working with Apple-specific file formats outside of the Apple ecosystem, providing programmatic access to data found in `.plist` files, such as `Info.plist` or iTunes configuration files.","status":"active","version":"3.1.0","language":"javascript","source_language":"en","source_url":"git://github.com/TooTallNate/node-plist","tags":["javascript","apple","browser","mac","plist","parser","xml"],"install":[{"cmd":"npm install plist","lang":"bash","label":"npm"},{"cmd":"yarn add plist","lang":"bash","label":"yarn"},{"cmd":"pnpm add plist","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This is the primary way to import and use the library in Node.js CommonJS modules, as demonstrated in the package's documentation.","symbol":"plist (CommonJS)","correct":"const plist = require('plist');"},{"note":"While the README primarily shows CommonJS, modern Node.js and browser environments typically use ESM. The package provides a default export for the `plist` object containing `parse` and `build` methods.","wrong":"import { plist } from 'plist';","symbol":"plist (ESM Default)","correct":"import plist from 'plist';"},{"note":"The `parse` and `build` functions are methods on the default `plist` object, not named exports from the top-level module. Attempting to destructure them directly from the module import will result in `undefined` values.","wrong":"import { parse, build } from 'plist';","symbol":"parse and build (as named exports)","correct":"import plist from 'plist'; const parsed = plist.parse(xml); const built = plist.build(obj);"}],"quickstart":{"code":"import plist from 'plist';\n\nconst xmlString = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n  <key>metadata</key>\n  <dict>\n    <key>bundle-identifier</key>\n    <string>com.company.app</string>\n    <key>bundle-version</key>\n    <string>0.1.1</string>\n    <key>kind</key>\n    <string>software</string>\n    <key>title</key>\n    <string>AppName</string>\n  </dict>\n</plist>`;\n\n// Parse the XML string into a JavaScript object\nconst parsedObject = plist.parse(xmlString);\nconsole.log('Parsed Object:', parsedObject);\n\n// Build a new plist XML string from a JavaScript object\nconst dataToBuild = [\n  'metadata',\n  {\n    'bundle-identifier': 'com.company.newapp',\n    'bundle-version': '1.0.0',\n    'kind': 'software',\n    'title': 'New App Name'\n  }\n];\nconst builtXml = plist.build(dataToBuild);\nconsole.log('Built XML:\\n', builtXml);","lang":"javascript","description":"Demonstrates parsing a plist XML string into a JavaScript object and then building a plist XML string from a JavaScript object using the library's main `parse` and `build` functions."},"warnings":[{"fix":"For Node.js, ensure your environment is Node.js 12.x or higher for native ESM support, or continue using `require()` for CommonJS modules. For browsers, ensure proper bundler configuration if using ESM imports.","message":"Version 3.x introduced changes that may affect older Node.js versions or browser environments. Ensure your runtime supports ES Modules if you are using `import` syntax, as older versions of Node.js (pre-12.x) may require `--experimental-modules` or be incompatible.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Always validate the input string before passing it to `plist.parse()`. Ensure it's a string and adheres to the plist DTD. Wrap calls in a `try...catch` block to handle potential parsing exceptions gracefully.","message":"The `plist.parse()` function expects a well-formed XML string representing a plist. Providing malformed XML, non-plist XML, or non-string input can lead to parsing errors or unexpected output.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Structure your JavaScript object to closely mirror the expected plist structure (e.g., plain objects for dictionaries, arrays for arrays, primitive types for strings/numbers/booleans). Avoid circular references or non-serializable objects.","message":"The `plist.build()` function expects a JavaScript object or array that can be directly mapped to plist data types. Providing complex or non-standard JavaScript objects may result in malformed plist XML or errors.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'3.1.0':53 'access':135 'activ':58 'akin':40 'api':103 'appl':12,124,131,150 'apple-specif':123 'applic':39 'base':27 'binari':29,86 'browser':21,151 'bug':66 'build':11 'common':33 'compat':80 'configur':44,147 'convert':105 'cross':78 'cross-platform':77 'current':49 'data':31,46,137 'depend':68 'develop':59,120 'differenti':74 'driven':64 'ecosystem':132 'enhanc':72 'environ':22 'essenti':117 'facil':7 'featur':71 'file':16,32,126,141,148 'fix':67 'focus':97 'format':88,127 'found':138 'function':94 'impli':89 'includ':75 'info.plist':144 'io':38 'itun':146 'javascript':107,149 'json':42 'key':73 'librari':4,93 'list':14 'mac':152 'maco':36 'maintain':56 'node.js':19 'object':108 'outsid':128 'packag':114 'pars':9 'parser':154 'platform':79 'plist':1,3,15,23,87,92,110,140,153 'primarili':63 'programmat':134 'properti':13 'provid':5,133 'readm':96 'releas':62 'robust':6 'specif':125 'stabl':50 'status':60 'storag':47 'straightforward':102 'string':112 'structur':30 'support':81 'though':95 'tool':118 'typic':91 'updat':69 'use':34 'version':51 'work':121 'xml':26,84,99,111,155 'xml-base':25","created_at":"2026-04-20T01:56:15.544371+00:00","updated_at":"2026-04-20T01:56:15.544371+00:00","problems":[{"fix":"Verify that `plist` is correctly imported. If using CommonJS, `const plist = require('plist');` is correct. If using ESM, `import plist from 'plist';` should be used, as `parse` is a method of the default export, not a named export itself.","cause":"Attempting to call `parse` on an `undefined` or incorrectly imported `plist` object, often due to a mixed CommonJS/ESM environment or incorrect `require`/`import` syntax.","error":"TypeError: plist.parse is not a function"},{"fix":"Review the JavaScript object being passed to `plist.build()`. Ensure all values are primitive types (string, number, boolean), arrays, or plain objects (dictionaries). Avoid `null`, `undefined`, functions, or complex class instances that `plist` cannot automatically convert.","cause":"This error typically occurs within the `plist.build()` function when it encounters a JavaScript value it doesn't know how to serialize into a plist XML tag.","error":"Error: Unknown plist type 'undefined'"},{"fix":"Ensure that plist XML content is read as a string (e.g., using `fs.readFileSync` in Node.js) and then explicitly passed to `plist.parse()`. Do not attempt to `import` or `require` a `.plist` file directly.","cause":"This error might occur when a bundler or runtime tries to interpret plist XML content as JavaScript code, likely due to loading a `.plist` file directly without processing it through the `plist.parse` function, or attempting to `require()` a `.plist` file directly.","error":"SyntaxError: Unexpected token '<'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.0.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://www.npmjs.com/package/plist","github":"https://github.com/TooTallNate/plist.js","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/plist","openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}