ACARS is an aircraft communications messaging protocol that has been in use worldwide for a few decades. This library exists to specifically decode the text portion of the ACARS message payload.
The library is built around research and discoveries from the ACARS Message Documentation, a community effort to document the details of the ACARS message label/text payload.
It has been written in TypeScript (which compiles to Javascript) and is published as an NPM package.
You are welcome to contribute (please see https://github.com/airframesio/acars-message-documentation where we collaborate to research and document the various types of messages), and while it was primarily developed to power Airframes and AcarsHub, you may use this library in your own applications freely.
- Runtime support: Node.js >= 18
- Development and CI: tests run on Node 22.x, 24.x and 26.x. The test toolchain (Babel 8) needs Node 22.18+ or 24.11+; the published package does not use it, so the runtime support above is unchanged.
- TypeScript development uses the latest stable Node types (currently v24) without forcing consumers to use a specific Node types version, since
@types/nodeis a devDependency. - The published builds are compiled targeting Node 18 runtime via
tsupso they remain compatible across supported Node versions.
Add the @airframes/acars-decoder library to your JavaScript or TypeScript project.
With yarn:
yarn add @airframes/acars-decoder
With npm:
npm install @airframes/acars-decoder
Documentation coming soon.
Long downlinks (maintenance pages, weather reports, flight plans) are sent in
several blocks, and only the first block carries the report's header. Join the
blocks with MessageReassembler before decoding:
import { MessageDecoder, MessageReassembler } from '@airframes/acars-decoder';
const decoder = new MessageDecoder();
const reassembler = new MessageReassembler();
function onBlock(block) {
// block: { label, text, tail and/or airframe_id, message_number,
// message_number_seq, block_id, block_end or more, timestamp, id }
for (const message of reassembler.add(block)) decoder.decode(message);
}
// Every few seconds, on the same clock as the blocks' timestamps:
const tick = setInterval(() => {
reassembler.flush(Date.now()).forEach((m) => decoder.decode(m));
}, 5000);
// At shutdown, hand on what is still held:
function stop() {
clearInterval(tick);
reassembler.drain().forEach((m) => decoder.decode(m));
}addreturns what is ready: a block that can't be matched (no message number, tail or block id) at once, and a joined message when every block up to the last has arrived (in any order when the feed sends part letters).- When replaying a log, pass the log's time to
flush(and toaddif the blocks have notimestamp), not the machine clock. - A feed that can't say which block is last (no part letter and no
more, like dumpvdl2 stored before aggregation-server 0.44.2) has every block held until no block has arrived forquietMs(20 s), including single-block messages. Feeds with part letters ormorehand single blocks on at once. - The same block heard by a second station is dropped (the longer copy is
kept). The aircraft is the registration (case and leading dots ignored),
else
airframe_id. - libacars-based decoders and xng send the last block again with the whole text; it replaces the blocks held so far. A message longer than one block (220 characters) is passed straight through.
- For a stored list (a flight's messages),
reassembleMessages(blocks)returns the joined messages in time order.
Each result has parts, message_ids, block_ids and complete.
Contributions are welcome! Please follow the ACARS Message Documentation when implementing. Most find that this makes things a lot easier. Submit a Pull Request and we will gratefully review and merge.
| Contributor | Description |
|---|---|
| Kevin Elliott | Primary Airframes contributor |
| Michael Johnson | Decoder plugins, testing framework |
| Mark Bumiller | Decoder plugins, tests, utilities |