Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: avoid known file signatures in datatypeId (#155)
This is just a performance optimization for the Mapeo indexer so that it avoids trying to parse files that are not Mapeo Docs. For example, a hypercore might have PNG files written to it, which is prefixed by '89 50 4E 47 0D 0A 1A 0A'. If we used this as a dataTypeId then the indexer would think any PNGs in the core are a Mapeo datatype and try to parse them. It would fail and just be ignored, but trying to parse would have a performance cost. This is a check in the build script that will throw an error if a new dataType is added that matches one of the known file signature prefixes. In some cases we don't check against the whole file signature - we just avoid starting data type IDs with byte(s) that are common in file signatures.
- Loading branch information