bplist-parser is a JavaScript library designed to parse Apple's binary Property List (.bplist) files. These files are a compact, binary representation often used by macOS and iOS for storing structured data, as an alternative to XML plists. The current stable version is 0.3.2, which was last published to npm approximately four years ago, indicating a very slow or effectively halted release cadence. While the GitHub repository shows some minimal activity related to ESM conversion more recently, the published npm package remains CommonJS-centric. The package includes TypeScript type definitions. Its key differentiator is its singular focus on parsing binary plists, without support for XML or OpenStep plist formats, making it suitable for applications specifically dealing with this file type, though users should be aware of its infrequent updates.
npm install bplist-parserVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to parse a binary Property List (bplist) file using `bplist-parser`. It shows both CommonJS `require` usage (implicitly via `import * as`) and the `parseFile` and `parseBuffer` methods, including basic TypeScript type usage. A dummy binary plist buffer is used for direct `parseBuffer` demonstration, as creating a valid binary plist file dynamically is outside the scope of a quickstart.
For ESM, use `import * as bplist from 'bplist-parser';`. If using TypeScript, ensure `esModuleInterop` is enabled in `tsconfig.json`. In CommonJS, continue to use `const bplist = require('bplist-parser');`.Monitor the GitHub repository for any new forks or community-maintained alternatives that offer more active development. Review the source code and dependencies for known vulnerabilities if using in a security-sensitive application. Consider newer, more actively maintained alternatives if available for your specific use case, such as `@plist/binary.parse` or `bplist-lossless`.
For very large files, consider pre-processing or breaking them down if possible. If you encounter errors related to object size or count, you might need to explore modifying these limits directly in a forked version of the library or choosing an alternative parser that allows configurable limits.
Ensure the input file is indeed a binary plist (.bplist) and not an XML plist (.plist) or any other file type. Validate the file's integrity. If you're dealing with XML plists, you need a different parser (e.g., `plist` npm package).
In ESM, use `import * as bplist from 'bplist-parser';` to import the entire module as a namespace object. Then access `bplist.parseFile`. Alternatively, if your project supports it, use `const bplist = require('bplist-parser');`.