Skip to content

TomasHubelbauer/js-protobuf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript Protobuf

DEMO

A JavaScript library for decoding the ProtocolBuffers wire format (with or without a schema). This is work in progress.

This library is tested on a Prague OSM extract file by BBBike.org: https://download.bbbike.org/osm/bbbike/Prag/

It is validated against https://protogen.marcgravell.com/decode

The ProtoBuf wire format is documented at: https://developers.google.com/protocol-buffers/docs/encoding

To run it locally, run it using npx serve . as it uses fetch to get the PBF file which doesn't work off the file:// protocol in Chrome (does in Firefox).

To-Do

Recognize strings whose embedded content is just the same string

(length diff = length varint byte length) and collapse the embedded content into one entry (not one parent one child).

Extend the library to cover both scenarios without and with a schema

Parse https://github.com/substack/osm-pbf-parser/blob/master/lib/osmformat.proto to find structures and then parse the Prague extract into those structures.

Compare my implementation with NNN.js

https://github.com/photopea/UNN.js/blob/master/UNN.util.js#L135

Use getVarint from my ESM varint library

https://github.com/TomasHubelbauer/esm-dataview-getvarint