Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/samasaur1/bencodekit
https://github.com/samasaur1/bencodekit
Last synced: 19 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/samasaur1/bencodekit
- Owner: Samasaur1
- Created: 2024-11-03T07:15:17.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-27T21:46:28.000Z (about 2 months ago)
- Last Synced: 2024-11-27T22:29:11.000Z (about 2 months ago)
- Language: Swift
- Size: 51.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BencodeKit
This package provides the `BencodeEncoder` and `BencodeDecoder` types, which allow converting `Codable` structs to data and back.
### Usage
See the `Tests/BencodeKitTests` directory for example usage.
### Strengths
This library integrates well with the existing `Codable` protocols and follows the same pattern as `JSONEncoder`/`JSONDecoder`, which means its use is familiar to Swift developers.
### Limitations
We are limited to the types that bencode supports. This means that for things such as `Bool`s, the two options are to immediately crash (what we do), to encode them as types that bencode supports, or to introduce a `BenCodable` struct that conforms to `Codable` but doesn't allow `Bool`s or other non-bencode-supported types.
There are also some cases where this library will crash instead of throwing an error that can be handled, due to how it is structured internally. This is on my list to improve.
### Notes
A huge amount of credit goes to