A TypeScript library for parsing Java-style .properties files with support for comments, multi-line values, escaped characters, and Unicode sequences.
- Parse
.propertiesfile format (key-value pairs) - Support for comments (
#and!prefixes) - Multi-line value support (backslash continuation)
- Escape sequence handling (
\:,\=,\, etc.) - Unicode character sequences (
\uHHHH) - Invalid entry detection and reporting
- Zero dependencies
- Full TypeScript support with type definitions
npm install @dexcalibur/dxc-parser-propertiesimport { Properties } from '@dexcalibur/dxc-parser-properties';
// Parse a properties file from a Buffer
const buffer = Buffer.from(`
# Application configuration
version=21.0.1
client=firebase-abt
# Multi-line value
description=This is a long \\
description value
`);
const results = Properties.Parser.fromBuffer(buffer, 0);
// Access parsed properties
console.log(results.ok['version'].value); // "21.0.1"
console.log(results.ok['client'].value); // "firebase-abt"
// Check for invalid entries
console.log(results.invalid); // Array of invalid entriesParses a properties file from a Buffer.
Parameters:
buffer: Buffer- The buffer containing the properties file contentoffset: number- Starting offset in the buffer (typically 0)eol?: string- Optional end-of-line character (defaults to OS-specific EOL)
Returns: Properties.Results
{
ok: Record<string, Entry>; // Successfully parsed entries
invalid: Entry[]; // Invalid entries
}Represents a single property entry:
interface Entry {
key?: string; // Property key
value?: string; // Property value
comment?: string; // Associated comments
line: number; // Starting line number
lineCount: number; // Number of lines this entry spans
invalid?: boolean; // Whether the entry is invalid
}Decodes escape sequences in a property string.
Parameters:
encodedStr: string- The string with escape sequences
Returns: string - Decoded string
Supports:
- Leading/trailing whitespace removal
- Escaped characters (
\:,\=,\) - Unicode sequences (
\uHHHH)
The parser supports standard Java .properties file format:
key=value
another.key:another valueSupported separators: = or :
# This is a comment
! This is also a comment
key=valuelong.value=This is a \
multi-line \
valuekey.with.space=value\ with\ spaces
key.with.separator=value\:with\:colons
unicode.char=\u00FF- Format names:
properties - File extensions:
.properties - Format UID:
properties_1.0.0
npm run buildnpm testThis project is licensed under the AGPL-3.0-only License.
Copyright (C) 2026 Reversense SAS
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License.
See LICENSE for details.
This library is part of the Reversense platform, an automated reverse engineering and analysis platform focused on security, privacy, quality, accessibility, and safety assessment of software, including mobile apps and firmware.