https://github.com/friedemannsommer/lcov-parser
A LCOV file parser.
https://github.com/friedemannsommer/lcov-parser
lcov parser typescript
Last synced: about 1 year ago
JSON representation
A LCOV file parser.
- Host: GitHub
- URL: https://github.com/friedemannsommer/lcov-parser
- Owner: friedemannsommer
- License: mit
- Created: 2023-08-22T20:16:00.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-21T17:50:27.000Z (over 1 year ago)
- Last Synced: 2025-03-27T16:55:49.537Z (over 1 year ago)
- Topics: lcov, parser, typescript
- Language: TypeScript
- Homepage: https://friedemannsommer.github.io/lcov-parser/
- Size: 2.97 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# LCOV parser
A LCOV file parser, written in TypeScript.
[][npm]
[](https://github.com/friedemannsommer/lcov-parser/actions/workflows/ci.yml)
[](https://codecov.io/gh/friedemannsommer/lcov-parser)

> This parser is built for the LCOV trace file format, which can be found
> here: [github.com/linux-test-project/lcov/man/geninfo.1][lcov-format].
>
> You're able to use different field names, if necessary.
## Installation
```shell
npm install --save-dev --save-exact @friedemannsommer/lcov-parser
```
or the shorter equivalent:
```shell
npm i -DE @friedemannsommer/lcov-parser
```
## Basic usage
[`string`][string-glossary] data
```typescript
import lcovParser from "@friedemannsommer/lcov-parser/sync"
const sections = lcovParser({ from: "" })
```
[`Buffer`][buffer-docs] / [`ArrayBuffer`][array-buffer-docs]
```typescript
import lcovParser from "@friedemannsommer/lcov-parser/sync"
const sections = lcovParser({ from: Buffer.from("") })
```
[`Readable`][readable-docs] streams
```typescript
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][package-docs].
[array-buffer-docs]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
[buffer-docs]: https://nodejs.org/api/buffer.html#class-buffer
[lcov-format]: https://github.com/linux-test-project/lcov/blob/3decc12ab1e7b34d2860393e2f40f0e1057d5c16/man/geninfo.1#L989-L1171
[npm]: https://www.npmjs.com/package/@friedemannsommer/lcov-parser
[package-docs]: https://friedemannsommer.github.io/lcov-parser/
[readable-docs]: https://nodejs.org/api/stream.html#readable-streams
[string-glossary]: https://developer.mozilla.org/en-US/docs/Glossary/String