🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@frihet/aeb43-parser

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frihet/aeb43-parser

AEB43 (Norma 43) Spanish bank statement parser for TypeScript. Supports BBVA, Santander, Sabadell, CaixaBank, Bankinter, and all AEB-standard N43 files.

latest
Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

@frihet/aeb43-parser

TypeScript parser for AEB43 (Norma 43) Spanish bank statement files (.N43 / .n43).

Supports BBVA, Santander, Sabadell, CaixaBank, Bankinter, and any bank that follows the AEB standard.

License: Apache-2.0

Installation

npm install @frihet/aeb43-parser
# or
pnpm add @frihet/aeb43-parser

Usage

import { parseAEB43 } from '@frihet/aeb43-parser';
import { readFileSync } from 'node:fs';

// AEB43 files use ISO-8859-1 (latin1) encoding
const content = readFileSync('statement.n43', 'latin1');
const statement = parseAEB43(content);

console.log(`Accounts: ${statement.accountCount}`);

for (const account of statement.accounts) {
  console.log(`Account: ${account.accountId}`);
  console.log(`Opening: ${account.openingBalance} EUR`);
  console.log(`Closing: ${account.closingBalance} EUR`);

  for (const tx of account.transactions) {
    console.log(`${tx.operationDate} ${tx.amount}${tx.description}`);
  }
}

Browser (File input)

import { parseAEB43, isAEB43 } from '@frihet/aeb43-parser';

async function handleFile(file: File) {
  // Detect format
  const firstBytes = await file.slice(0, 120).text();
  if (!isAEB43(firstBytes, file.name)) {
    throw new Error('Not an AEB43 file');
  }

  // Read as latin1 (AEB43 encoding)
  const buffer = await file.arrayBuffer();
  const content = new TextDecoder('iso-8859-1').decode(buffer);

  return parseAEB43(content);
}

API

parseAEB43(content: string): AEB43Statement

Parse an AEB43 file content string. Both LF and CRLF line endings are supported.

Throws AEB43ParseError on structural violations (bad sign chars, wrong record count, unknown record types, etc.).

isAEB43(content: string, fileName?: string): boolean

Detect whether content (or a filename) is likely AEB43 format. Checks .n43 / .N43 extension and/or the record-11 content signature.

Types

interface AEB43Statement {
  accountCount: number;
  totalRecords: number;
  accounts: AEB43Account[];
}

interface AEB43Account {
  entityCode: string;     // e.g. '0049' (Santander), '0182' (BBVA)
  branchCode: string;     // 4-digit branch
  accountNumber: string;  // 10-digit account
  accountId: string;      // '{entity}-{branch}-{account}'
  startDate: string;      // ISO 8601 YYYY-MM-DD
  endDate: string;        // ISO 8601 YYYY-MM-DD
  openingBalance: number; // Positive = credit, Negative = debit
  closingBalance: number;
  totalDebits: number;
  totalCredits: number;
  debitCount: number;
  creditCount: number;
  transactions: AEB43Transaction[];
}

interface AEB43Transaction {
  operationDate: string;       // ISO 8601 YYYY-MM-DD
  valueDate: string;           // ISO 8601 YYYY-MM-DD (fecha valor)
  amount: number;              // Positive = credit, Negative = debit
  conceptCode: string;         // 2-digit AEB concept code
  description: string;         // Primary description (from reference fields)
  additionalDescription: string; // From record 23/24 extension lines
  reference1: string;          // Document number field
  reference2: string;          // Secondary reference
  rawLine: string;             // Original 80-char record 22 line
}

AEB43 Format Reference

AEB43 (Norma 43) is a fixed-width, 80-character per line ASCII format published by the Asociación Española de Banca (AEB).

Record types:

  • 11: Account header (entity, branch, account, dates, opening balance)
  • 22: Transaction (dates, concept code, amount, references)
  • 23/24: Additional concept text extending the previous transaction
  • 33: Account footer (totals, closing balance)
  • 88: File footer (account count, total record count)

Amount encoding: sign char (1 = positive, 2 = negative) followed by digits with 2 implicit decimal places. Date encoding: YYMMDD — year < 50 maps to 20xx, year >= 50 maps to 19xx.

Official spec: AEB Norma 43

Publishing

This package is publish-ready. To publish to npm when approved:

cd packages/aeb43-parser
npm run build       # Compile TypeScript to dist/
npm publish --access public

Ensure dist/ is built and clean before publishing. The prepublishOnly script runs build automatically.

License

Apache-2.0 — see LICENSE.

Built by Frihet — AI-native ERP for freelancers and SMEs.

Keywords

aeb43

FAQs

Package last updated on 11 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts