Skip to content

Commit

Permalink
support only reading class
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr Martian committed Jan 21, 2025
1 parent 17d25dd commit 632ff32
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 149 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ pbf.writeVarintField(1, 1);
const result = pbf.commit();
```

If you want to reduce build size and know you're only reading data, not writing to it, use the `PbfReader` class:

```ts
import { readFileSync } from 'fs';
import { PbfReader } from 'pbf-ts';

const pbf = new PbfReader(readFileSync(path));
// ...
```

More complex example:

```ts
Expand Down
Binary file modified bun.lockb
Binary file not shown.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pbf-ts",
"version": "1.0.3",
"version": "1.1.0",
"description": "A low-level, fast, ultra-lightweight typescript library for decoding and encoding protocol buffers.",
"type": "module",
"keywords": [
Expand Down Expand Up @@ -56,18 +56,18 @@
"homepage": "https://github.com/Open-S2/s2-tools#readme",
"devDependencies": {
"@skypack/package-check": "^0.2.2",
"@types/bun": "^1.1.16",
"@types/node": "^22.10.5",
"@types/bun": "^1.1.18",
"@types/node": "^22.10.7",
"coveralls": "^3.1.1",
"eslint": "^9.18.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsdoc": "^50.6.1",
"eslint-plugin-prettier": "^5.2.1",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-jsdoc": "^50.6.2",
"eslint-plugin-prettier": "^5.2.3",
"eslint-plugin-tsdoc": "^0.4.0",
"prettier": "^3.4.2",
"typedoc": "^0.27.6",
"typedoc-plugin-coverage": "^3.4.1",
"typescript": "^5.7.3",
"typescript-eslint": "^8.19.1"
"typescript-eslint": "^8.21.0"
}
}
Loading

0 comments on commit 632ff32

Please sign in to comment.