Skip to content

Read a CAR file and describe its blocks using IPLD Schemas

License

Notifications You must be signed in to change notification settings

rvagg/car-to-schema

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@rvagg/car-to-schema

Read a CAR file and describe its blocks using IPLD Schemas.

Usage

Install

$ npm install @rvagg/car-to-schema -g

Run

$ car-to-schema <path-to-CAR-file> --output=<output/dir>

Unqiue found schemas will be printed to stdout as well as written to files in the current working directory named schema_X.ipldsch (the human-readable text form), where X is the unique schema number. A schema_summary.csv will also be written with a mapping of the schema to the number of blocks found matching that schema.

Options:

  • --library=<schema/library/dir> - provide a path to a directory containing an existing library of schemas, see below.
  • --novel-out=<path/to/out.car> - write out a new car containin only blocks that don't match schemas in the library. This can be used when authoring the library of schemas and you are narrowing down to just the blocks that are not recognised.

Library

If you have existing Schemas to match against, supply a directory path with --library and the Schemas found in that directory will be included in the matching process. Schema files should end with .ipldsch (or the object form can be .json).

The name of each Schema file in the library directory should be the name of the root type in the Schema. e.g. A Schema Schema describing the DAG-PB structure might be named PBNode.ipldsch and include a type PBNode. This type will be matched against the root found in the block.

Limitations

Currently only supports the following codecs for blocks:

  • DAG-CBOR
  • DAG-JSON
  • DAG-PB
  • raw
  • json

See also the Limitations section of ipld-schema-describer for the limitations of Schema inference on objects.

License & Copyright

Copyright 2020 Rod Vagg

Licensed under Apache 2.0 (LICENSE-APACHE / http://www.apache.org/licenses/LICENSE-2.0)

About

Read a CAR file and describe its blocks using IPLD Schemas

Resources

License

Stars

Watchers

Forks

Packages

No packages published