A LCOV file parser, written in TypeScript.
This parser is built for the LCOV trace file format, which can be found here: github.com/linux-test-project/lcov/man/geninfo.1.
You're able to use different field names, if necessary.
npm install --save-dev --save-exact @friedemannsommer/lcov-parser
or the shorter equivalent:
npm i -DE @friedemannsommer/lcov-parser
string
data
import lcovParser from "@friedemannsommer/lcov-parser"
const sections = await lcovParser({from: "<LCOV data>"})
import lcovParser from "@friedemannsommer/lcov-parser"
const sections = await lcovParser({from: Buffer.from("<LCOV data>")})
Readable
streams
import lcovParser from "@friedemannsommer/lcov-parser"
import {createReadStream} from "node:fs"
const lcovFile = createReadStream(new URL("path/to/lcov.info", import.meta.url))
const sections = await lcovParser({from: lcovFile})
For more details, take a look at the documentation, which can be found here: friedemannsommer.github.io/lcov-parser.