{"name":"plist","version":"5.1.1","keywords":["apple","browser","mac","plist","parser","xml"],"author":{"name":"Nathan Rajlich","email":"nathan@tootallnate.net"},"license":"MIT","_id":"plist@5.1.1","maintainers":[{"name":"tootallnate","email":"nathan@tootallnate.net"}],"contributors":[{"name":"Hans Huebner","email":"hans.huebner@gmail.com"},{"name":"Pierre Metrailler"},{"name":"Mike Reinstein","email":"reinstein.mike@gmail.com"},{"name":"Vladimir Tsvang"},{"name":"Mathieu D'Amours"}],"homepage":"https://github.com/TooTallNate/plist.js#readme","bugs":{"url":"https://github.com/TooTallNate/plist.js/issues"},"dist":{"shasum":"8099dfd2e0385a6c35784249191365c458e5b9dc","tarball":"http://registry-npm.ywwl.com/plist/download/plist-5.1.1.tgz","fileCount":43,"integrity":"sha512-n55fGiwWNHf6zFdP9qvtr1x7P898lfJ/rbDvB3pYqVRcO+iG3sl5SSkGSLiIoAI9ZZc2F3Ga/5wPtM8EqhgSqA==","signatures":[{"sig":"MEYCIQD3ZxjgHHV5xLQMYltNP7q+GOPDJbCCpvlVqaCjgZAD3wIhANiWohfdYSe1xOIm8aDMcl5BIh7z1Q34zO2wR7nebulz","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIAavM2LPPujuoZ+RAar6yCY+AKG4RI1fjuBh6pnqA0d1AiEA2O0bfN8Wo4oXVfEE4+LATDP+xDnb1RPdWqi5o0JXIzk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/plist@5.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":109794,"size":21705,"noattachment":false,"key":"/plist/-/plist-5.1.1.tgz"},"main":"./dist/index.js","type":"module","_from":"file:plist-5.1.1.tgz","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"browser":{"types":"./dist/index.d.ts","default":"./dist/index.browser.js"},"default":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"scripts":{"test":"vitest run","build":"tsc","ci:publish":"changeset publish"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"c018135a-1472-4cdb-b630-c9364348970e"}},"_resolved":"/tmp/aa1bb2d0c276dd8725755859d763b31e/plist-5.1.1.tgz","_integrity":"sha512-n55fGiwWNHf6zFdP9qvtr1x7P898lfJ/rbDvB3pYqVRcO+iG3sl5SSkGSLiIoAI9ZZc2F3Ga/5wPtM8EqhgSqA==","repository":{"url":"git+https://github.com/TooTallNate/plist.js.git","type":"git"},"_npmVersion":"11.21.2","description":"Apple's property list parser/builder for Node.js and browsers","directories":{},"_nodeVersion":"24.22.2","dependencies":{"xmlbuilder":"^15.1.1","@xmldom/xmldom":"^0.9.10"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.12","typescript":"^5.9.3","@changesets/cli":"^2.31.0"},"_npmOperationalInternal":{"tmp":"tmp/plist_5.1.1_1794255058619_0.5791332522531685","host":"s3://npm-registry-packages-npm-production"},"readme":"# plist.js\n\nApple property list parser/builder for Node.js and browsers. Supports **XML**, **binary** (bplist00), and **OpenStep** formats.\n\n[![CI](https://github.com/TooTallNate/plist.js/actions/workflows/ci.yml/badge.svg)](https://github.com/TooTallNate/plist.js/actions/workflows/ci.yml)\n[![npm](https://img.shields.io/npm/v/plist)](https://www.npmjs.com/package/plist)\n[![npm bundle size](https://img.shields.io/bundlephobia/minzip/plist)](https://bundlephobia.com/package/plist)\n\n**[Try it in the browser →](https://plist.n8.io/)**\n\n## Features\n\n- **Parse** XML, binary, and OpenStep plists — format is auto-detected\n- **Build** XML and binary plists from JavaScript objects\n- **TypeScript** — written in TypeScript with full type declarations\n- **Browser-optimized** — uses native `DOMParser` in browsers (zero dependencies)\n- **Lightweight** — ~4 KB gzipped in the browser\n\n## Install\n\n```bash\nnpm install plist\n```\n\n## Quick Start\n\n```ts\nimport { parse, build } from 'plist';\n\n// Parse any plist format (auto-detected)\nconst obj = parse('<plist version=\"1.0\"><string>Hello!</string></plist>');\nconsole.log(obj); // \"Hello!\"\n\n// Build an XML plist from a JS object\nconst xml = build({ name: 'My App', version: 42 });\nconsole.log(xml);\n```\n\n## Parsing\n\n### XML Plists\n\n```ts\nimport { readFileSync } from 'node:fs';\nimport { parse } from 'plist';\n\nconst xml = readFileSync('Info.plist', 'utf8');\nconst obj = parse(xml);\n```\n\n### Binary Plists\n\nBinary plists (bplist00) are auto-detected when passed as a `Uint8Array` or `ArrayBuffer`. You can also use `parseBinary()` directly:\n\n```ts\nimport { readFileSync } from 'node:fs';\nimport { parse, parseBinary } from 'plist';\n\n// Auto-detected from binary data\nconst buf = readFileSync('Info.plist');\nconst obj = parse(new Uint8Array(buf));\n\n// Or use parseBinary() directly\nconst obj2 = parseBinary(new Uint8Array(buf));\n```\n\n### OpenStep Plists\n\nThe old-style ASCII format (used by `defaults read` on macOS) is auto-detected when the input starts with `{` or `(`:\n\n```ts\nimport { parse, parseOpenStep } from 'plist';\n\n// Auto-detected\nconst obj = parse('{ CFBundleName = \"My App\"; CFBundleVersion = 42; }');\n\n// Or use parseOpenStep() directly\nconst obj2 = parseOpenStep('( item1, item2, item3 )');\n```\n\n## Building\n\n### XML Output\n\n```ts\nimport { build } from 'plist';\n\nconst xml = build({\n  CFBundleName: 'My App',\n  CFBundleVersion: '1.0',\n  LSRequiresIPhoneOS: true,\n  UISupportedInterfaceOrientations: [\n    'UIInterfaceOrientationPortrait',\n    'UIInterfaceOrientationLandscapeLeft',\n  ],\n});\n```\n\nOutput:\n\n```xml\n<?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  <dict>\n    <key>CFBundleName</key>\n    <string>My App</string>\n    <key>CFBundleVersion</key>\n    <string>1.0</string>\n    <key>LSRequiresIPhoneOS</key>\n    <true/>\n    <key>UISupportedInterfaceOrientations</key>\n    <array>\n      <string>UIInterfaceOrientationPortrait</string>\n      <string>UIInterfaceOrientationLandscapeLeft</string>\n    </array>\n  </dict>\n</plist>\n```\n\n### Binary Output\n\n```ts\nimport { writeFileSync } from 'node:fs';\nimport { buildBinary } from 'plist';\n\nconst data = buildBinary({\n  CFBundleName: 'My App',\n  CFBundleVersion: '1.0',\n});\n\nwriteFileSync('Info.plist', data);\n```\n\n## Type Mapping\n\n| Plist Type | JavaScript Type |\n|---|---|\n| `<string>` | `string` |\n| `<integer>` | `number` |\n| `<real>` | `number` |\n| `<true/>` / `<false/>` | `boolean` |\n| `<date>` | `Date` |\n| `<data>` | `Uint8Array` |\n| `<array>` | `Array` |\n| `<dict>` | `Object` |\n\n## Browser Usage\n\nIn 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):\n\n```ts\nimport { parse, build } from 'plist';\n```\n\nThe browser build uses native `DOMParser` and string-based XML building, so `@xmldom/xmldom` and `xmlbuilder` are not included in the bundle.\n\n**[Try the interactive playground →](https://plist.n8.io/)**\n\n## API\n\n### `parse(input)`\n\nParse a plist. Format is auto-detected.\n\n- **input**: `string | Uint8Array | ArrayBuffer`\n- **returns**: `PlistValue`\n\n### `parseBinary(data)`\n\nParse a binary plist (bplist00).\n\n- **data**: `Uint8Array`\n- **returns**: `PlistValue`\n\n### `parseOpenStep(input)`\n\nParse an OpenStep/ASCII plist.\n\n- **input**: `string`\n- **returns**: `PlistValue`\n\n### `build(obj, opts?)`\n\nBuild an XML plist string.\n\n- **obj**: `PlistValue`\n- **opts.pretty**: `boolean` (default: `true`) — pretty-print with indentation\n- **opts.indent**: `string` (default: `\"  \"`) — indentation string\n- **opts.newline**: `string` (default: `\"\\n\"`) — newline string\n- **opts.headless**: `boolean` (default: `false`) — omit the XML declaration and DOCTYPE\n- **opts.invalidCharReplacement**: `string` — replace characters that are not valid in XML output. By default, invalid XML characters throw.\n- **returns**: `string`\n\n### `buildBinary(obj)`\n\nBuild a binary plist (bplist00).\n\n- **obj**: `PlistValue`\n- **returns**: `Uint8Array`\n\n### `PlistValue`\n\n```ts\ntype PlistValue =\n  | string\n  | number\n  | boolean\n  | Date\n  | Uint8Array\n  | PlistValue[]\n  | { [key: string]: PlistValue }\n  | null;\n```\n\n## License\n\n[MIT](LICENSE)\n","publish_time":1794255058725,"_cnpm_publish_time":1794255058725,"dist-tags":{"latest":"5.1.2"}}