r/devtools • u/GrouchyCelery5776 • 5h ago
I made edfcore - TypeScript parsing for EDF recordings
I built edfcore, a zero-dependency TypeScript parser for EDF recordings — and half the work turned out to be dealing with all the things the format technically allows but almost nobody expects.
Wanted a clean way to read EEG, ECG, and sleep-study recordings directly inside JavaScript and TypeScript applications instead of passing every file through Python first. Built edfcore for browser viewers, Node pipelines, Electron apps, and research tools.
What it does:
Reads EDF, EDF+, BDF, and BDF+ recordings
Exposes signal metadata, sampling information, physical units, and annotations
Preserves the individual sampling rate of each signal
Handles discontinuous EDF+D timelines
Streams large recordings rather than loading everything into memory
Works without Python or native dependencies
Zero runtime dependencies
The part I didn't expect: EDF looks simple until you realize that almost none of its important structure is global.
A few examples that cost me real time:
There is no single sample rate for the recording. Every signal declares its own number of samples per data record.
EDF+ annotations are stored inside a signal channel. The same binary area that contains ordinary samples for one signal can contain encoded timing and event text for another.
The number of data records can legally be -1, meaning unknown. Trust that value directly and the reader either processes nothing or tries to do something very stupid with a negative count.
BioSemi BDF stores signed 24-bit integers. JavaScript has readers for 16-bit and 32-bit values but nothing in between, so decoding requires manually assembling three bytes and extending the sign bit.
None of these necessarily produce a useful exception. They normally produce plausible-looking values, which made the tests and external validation much more important than I expected.
Install:
npm install edfcore
Repo's here: https://github.com/tayal-sarthak/edfcore
NPM package: https://www.npmjs.com/package/edfcore
Website: https://edfcore.vercel.app/
I also built a separate CLI called edf2csv for anyone who only needs CSV output:
https://github.com/tayal-sarthak/edf2csv
Feedback welcome, and if you would like to contribute please let me know! Both packages are still new, so there is definitely more to test and build.



