crystal-cbor/README.md

73 lines
1.8 KiB
Markdown
Raw Normal View History

2020-04-17 14:32:43 +02:00
# CBOR
2020-04-19 13:55:23 +02:00
[![builds.sr.ht status](https://builds.sr.ht/~arestifo/crystal-cbor.svg)](https://builds.sr.ht/~arestifo/crystal-cbor?)
2020-04-17 14:32:43 +02:00
This library implements the [RFC7049: Concise Binary Object Representation (CBOR)][rfc]
in Crystal.
**WARNING:** This library is still a work in progress.
2020-04-23 09:41:46 +02:00
## Features
- Full support for diagnostic notation
2020-04-24 00:05:50 +02:00
- Assign a field to a type base on the CBOR tag
- Support for a wide range of IANA CBOR Tags (see below)
2020-04-23 09:41:46 +02:00
2020-04-17 14:32:43 +02:00
## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
cbor:
2020-04-19 14:05:27 +02:00
git: https://git.sr.ht/~arestifo/crystal-cbor
2020-04-17 14:32:43 +02:00
```
2. Run `shards install`
## Usage
```crystal
require "cbor"
```
TODO: Write usage instructions here
## Supported tags
All the tags specified in [section 2.4 of RFC 7049][rfc-tags] are supported
and the values are encoded in the respective Crystal types:
- `Time`
- `BigInt`
2020-05-08 11:40:18 +02:00
- `BigDecimal`
2020-05-08 11:40:26 +02:00
## Limitations
### Maximum Array/String array/Bytes array length
The spec allows for the maximum length of arrays, string arrays and bytes array
to be a `UInt64`.
While this library supports lengths expressed as a `UInt64`, it must not exceed
`Int32::MAX`.
2020-04-17 14:32:43 +02:00
## Development
TODO: Write development instructions here
## Contributing
2020-05-08 11:40:26 +02:00
The code is hosted on SourceHut and the development happens over the
[crystal-cbor mailing list][mailing-list].
2020-04-17 14:32:43 +02:00
2020-05-08 11:40:26 +02:00
You can send a patch to: [~arestifo/crystal-cbor@lists.sr.ht](mailto:~arestifo/crystal-cbor@lists.sr.ht).
2020-04-17 14:32:43 +02:00
2020-05-08 11:40:26 +02:00
To learn how to use `git send-email`, there is a great step-by-step tutorial
at [git-send-email.io](https://git-send-email.io/).
You might also want to read the [mailing list etiquette](https://man.sr.ht/lists.sr.ht/etiquette.md).
2020-04-17 14:32:43 +02:00
[rfc]: https://tools.ietf.org/html/rfc7049
[rfc-tags]: https://tools.ietf.org/html/rfc7049#section-2.4
2020-05-08 11:40:26 +02:00
[mailing-list]: https://lists.sr.ht/~arestifo/crystal-cbor