Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#44164·bun

Bun.PLIST: parse/stringify Apple property lists (XML, binary, OpenStep) + .plist loader

Author: matthew2564Created Sep 28, 2026Updated Sep 28, 2026
Labelsenhancement

What is the problem this feature would solve?

I'm building tooling that reads metadata out of iOS app builds. The starting point is an .ipa: unzip it, find Payload/<App>.app/Info.plist, and read values like CFBundleIdentifier, CFBundleShortVersionString and CFBundleVersion.

The zip part is the easy bit. The plist part pulled in more than expected:

  • The Info.plist inside a built app is either a binary plist (bplist00) or an XML one in the source tree, so an XML parser alone isn't enough.
  • I ended up on simple-plist, which wraps separate packages for XML (plist) and binary (bplist-parser / bplist-creator) etc
  • Source-side files have the same problem in other formats: Capacitor/React Native projects keep an XML Info.plist, and Xcode projects (project.pbxproj) and .strings files use the OpenStep text format.

Property lists are everywhere in Apple tooling (Info.plist, entitlements, provisioning profiles, .pbxproj, .strings, macOS preferences). Bun already parses TOML, YAML, JSON5 and now XML (Bun.XML, #37048) natively, and plists feel like a natural extension: the XML format is a small vocabulary on top of XML, and the other two formats are compact.

What is the feature you are proposing to solve the problem?

A Bun.PLIST namespace and a .plist loader, following the shape of Bun.TOML / Bun.XML.

API

typescript
// Format detected from the input: XML, binary (bplist00) or OpenStep
const info = Bun.PLIST.parse(await Bun.file("Payload/App.app/Info.plist").bytes());
info.CFBundleShortVersionString; // "5.22.0"

Bun.PLIST.stringify(info);                         // XML string, in Xcode's layout
Bun.PLIST.stringify(info, { format: "binary" });   // Uint8Array

import info from "./ios/App/App/Info.plist";
import strings from "./en.lproj/Localizable.strings" with { type: "plist" };

Type mapping: <dict> → object, <array> → array, <string> → string, <integer> → number (bigint outside ±2^53−1), <real> → number, <true/>/<false/> → boolean, <date> → Date, <data> → Uint8Array. A binary UID becomes { CF$UID: n }, which is how plutil writes it in XML, so it round-trips.

Architecture

The goal is to reuse what Bun already has rather than add a parallel stack:

  • XML plists on top of the existing XML parser. bun_parsers::xml already handles encodings, BOMs, entities, CDATA, well-formedness and error positions. The plist layer would only walk its node tree (the { compact: false } shape) and pair each <key> with the value that follows.
  • One AST for all three formats. Each format would parse into the same data-file AST the TOML/YAML/JSON5/XML loaders use. That gives Bun.PLIST.parse and import x from "./a.plist" one code path, so they can't drift apart, like Bun.TOML.parse and the TOML loader.
  • Date / Uint8Array in that AST. It is JSON-shaped, but TOML has already solved this: its date/time strings carry a toml_datetime tag that the runtime turns into Temporal values and the bundler turns into Temporal.*.from(...). I'd generalise that tag into a small enum (TOML date/time, Date, bytes). Then the runtime builds Date / Uint8Array directly, and bundled output contains new Date(ms) / new Uint8Array([...]) bound to the real globals (so a user variable named Date can't capture them). I'd use new Uint8Array([...]) over Uint8Array.fromBase64 so bundles still run on Node 22 and older browsers.
  • Binary (bplist00) read and write. A self-contained decoder and encoder over the offset-table format. The decoder treats input as untrusted: every offset and reference is checked against the file bounds, cycles are rejected, and output size is capped so shared containers can't cause exponential blow-up.
  • OpenStep read. A small recursive-descent parser following CoreFoundation's old-style rules: { k = v; }, ( a, b ), <hex>, quoted and unquoted strings, // and /* */ comments, and .strings files (bare k = v; pairs). Values are always strings, arrays, dictionaries or data, as in CoreFoundation.
  • Format detection by content: bplist magic → binary; < followed by XML markup → XML; anything else → OpenStep.

Verification plan

Apple's own tools are the reference implementation. plutil -convert xml1 can convert any real-world binary or OpenStep plist to XML, so every parser can be checked against Apple. Python's plistlib gives a byte-level reference for the binary writer. In practice:

  • test against real system files: macOS preferences, .pbxproj, .strings
  • fuzz the binary and OpenStep parsers
  • commit fixtures generated by those tools, rather than hand-written ones

Proposed PR split

  1. Bun.PLIST.parse / stringify (XML only)
  2. .plist loader + the generalised AST tag
  3. Binary read + write
  4. OpenStep read (not sure if wanted)

Open questions

  • Is plist support wanted in core, or is it better left to userland?
  • Naming: Bun.PLIST (matching Bun.TOML / Bun.XML) or something else?
  • Should .plist be a default loader, or only opt-in via with { type: "plist" }?
  • Is a binary writer in scope, or read-only binary to start?

Status

I have pre-emptively created some of this functionality locally, but I wanted to gauge the teamsopinion on whether it has any legs!

What alternatives have you considered?

  • npm packages (plist, bplist-parser, bplist-creator, simple-plist): these work, but cover different formats in separate packages, and some are unmaintained. None handle OpenStep, so .pbxproj needs yet another package (xcode, @bacons/xcode).

  • Shelling out to plutil: macOS only, which rules out Linux CI.

  • Bun.XML.parse: handles the XML format, but its compact shape groups elements by tag name, so each <key> loses its pairing with the value that follows. <true/> also becomes "". It can't read binary or OpenStep at all.

    Trade-offs I'd expect with this design:

    • JS has one number type, so <real>60.0</real> would round-trip as <integer>60</integer>.
    • Dates would keep milliseconds only.
    • There'd be no OpenStep writer: it would lose .pbxproj comments and Xcode's layout, and Xcode reads XML project files anyway.
    • The parser would be strict: a damaged file is a SyntaxError with a position, where plutil sometimes skips bad bytes quietly.

Source: oven-sh/bun

View original on GitHubView discussion on GitHub