Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rokf/janet-resp
A RESP encoder and decoder library for Janet
https://github.com/rokf/janet-resp
encoder-decoder janet janet-lang redis redis-client
Last synced: 14 days ago
JSON representation
A RESP encoder and decoder library for Janet
- Host: GitHub
- URL: https://github.com/rokf/janet-resp
- Owner: rokf
- License: mit
- Created: 2024-10-08T20:49:42.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-10-27T10:53:50.000Z (2 months ago)
- Last Synced: 2024-10-27T12:12:27.522Z (2 months ago)
- Topics: encoder-decoder, janet, janet-lang, redis, redis-client
- Language: Janet
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# janet-resp
janet-resp is a Janet module library for the Redis serialization protocol (RESP).
> [!IMPORTANT]
> The encoders and decoders still aren't fully implemented and things might
> change as I do more testing. Check the comments in the source files if
> you encounter unexpected behaviour.## Installation
You can install it through `jpm` with `jpm install https://github.com/rokf/janet-resp`
or by adding the following to the dependency list in your `project.janet` file:```janet
{ :url "https://github.com/rokf/janet-resp" :tag "main" }
```## API
### `resp/encode`
Encode takes a Janet value, encodes it into a RESP string, and returns that
string. Example:```janet
(resp/encode ["set" :color [255 100 50]])
```### `resp/decode`
Decode takes a RESP encoded string, decodes it, and produces a Janet value as
a response. Example:```janet
(resp/decode "*3\r\n$3\r\nset\r\n$5\r\ncolor\r\n*3\r\n:255\r\n:100\r\n:50\r\n")
```## Examples
See the `examples` folder for various examples using this module. The folder
contains a `compose.yaml` file which can be used with Docker Compose to spin
up services that are required for the examples to run.## License
MIT - details can be found in the `LICENSE` file at the root of the repository.