npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ekwo-ai/fec

v0.8.0

Published

The French FEC — fichier des ecritures comptables — in TypeScript: the eighteen columns of the arrete du 29 juillet 2013, from plain ledger rows, and read back into accounts, parties and entries. Zero dependencies.

Readme

@ekwo-ai/fec

The French FEC — fichier des écritures comptables — in TypeScript, with no dependencies.

Eighteen columns, in the order fixed by the arrêté du 29 juillet 2013 (art. A. 47 A-1 du Livre des procédures fiscales). Give it ledger rows and it gives you the file, the name the administration expects, and the list of what does not add up.

import { checkFec, fecFileName, fromQueryRow, generateFec } from '@ekwo-ai/fec';

const lines = rows.map(fromQueryRow); // rows of a `fec_lines(...)` query
const violations = checkFec(lines);   // empty, or what an inspector reads first
const file = generateFec(lines);      // `|` separated, comma decimals, CRLF
const name = fecFileName('123456789', '2026-12-31'); // 123456789FEC20261231.txt

FecQueryRow is the row shape of the fec_lines(company, from, to) function of Ekwo OS, declared here so that nothing is imported from it. Any book-keeping system that can produce those columns can use this package; it reads no database and knows no accounting.

The opening lines

A file that covers a whole financial year starts with its à-nouveaux: one line per balance-sheet account, at the balance it carried on the last day of the year before, on the opening journal and dated on the first day of the year. This package does nothing special with them — they arrive as ordinary rows, they carry one entry number of their own, and checkFec balances them like any other entry.

Where they come from is the producer's business. In Ekwo OS they are computed from the ledger rather than posted, and two of their properties are worth knowing when you read a file:

  • An unclosed year still carries its result. When the year before has not been closed, the difference between the balance-sheet lines is the result nobody has allocated yet, and it arrives as one more opening line on the balance-sheet account the close would have put it on. The file balances whether or not the meeting has happened.
  • The entries of a year-end close are not in the file of the year they close. They would show the result twice — once in the ordinary movements, once on the balance sheet — so the income statement reads from the movements as it always did, and the result reaches the balance sheet in the opening lines of the year that follows.

An extract that is not a whole financial year gets no opening lines: it is an extract of movements, and fecFileName is built from a year end.

Reading one back

readFec() goes the other way: the file this package writes, and the one any package that keeps books in France hands over when asked for a year, into the plain shape every reader of an accounting export in this repository declares — accounts, parties, entries, violations.

import { readFec } from '@ekwo-ai/fec';

const books = readFec(bytesOrString);                            // UTF-8, fatally
const latin = readFec(bytes, { encoding: 'iso-8859-15' });       // said, never guessed

books.entries;    // [{ journal: 'VE', number: '1', date: '2025-01-15', reference: 'F-001', lines: […] }, …]
books.contacts;   // one per CompAuxNum, named by CompAuxLib
books.violations; // an entry that does not balance, a line with two sides, an entry on two dates
  • The columns are found by their names in the header, which the arrêté makes mandatory: the variants of the text add columns (a cash-basis taxpayer's four) or write Montant and Sens instead of Debit and Credit, and all of them read.
  • The separator is the one the header uses, a tab or a vertical bar. Dates are AAAAMMJJ, refused otherwise; an amount has a comma or a point as its decimal mark and nothing else.
  • An entry is the lines that share a JournalCode and an EcritureNum. Each line keeps its party (CompAuxNum), its currency amount (Montantdevise, Idevise) and its reconciliation mark (EcritureLet).
  • A FEC is kept in the currency of the books and never says which, so currency is null. The à-nouveaux arrive as the entries of their journal, like any other: saying that journal is the opening is the importer's business.

What does not add up comes back in violations, the entry as written beside it; what is not a FEC is thrown as a BooksFileError with a code. In Ekwo OS this is ekwo import fec <file>.

The separators are options: decimalSeparator, fieldSeparator, newline, header. The defaults are what the French tooling expects.

MIT.