Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/icendoan/bqn-bindings
Some miscellaneous bindings for useful C libraries from BQN
https://github.com/icendoan/bqn-bindings
bqn
Last synced: 29 days ago
JSON representation
Some miscellaneous bindings for useful C libraries from BQN
- Host: GitHub
- URL: https://github.com/icendoan/bqn-bindings
- Owner: icendoan
- License: gpl-3.0
- Created: 2022-10-16T17:03:51.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-16T22:19:05.000Z (about 2 years ago)
- Last Synced: 2024-08-04T00:12:02.006Z (4 months ago)
- Topics: bqn
- Homepage:
- Size: 28.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-bqn - bqn-bindings
README
# bqn-bindings
Some miscellaneous bindings for useful C libraries from BQN# cURL - network protocols
A set of bindings for the easy api from [libcurl](https://curl.se/libcurl/).Currently very barebones, and only the required options for HTTP(S) GET is implemented, using default values for effectively everything.
Example:
```
curl ← •Import "bqn-bindings/curl.bqn"
html ← "./page.html" curl.Get "https://curl.haxx.se" # writes the html to "./page.html" and returns it to the caller
```# Jansson - JSON parsing and manipulation
A set of bindings for [jansson](https://github.com/akheron/jansson), which can parse, write, and manipulate JSON.
There is a small API wrapping the libjansson C api, see the method comments in `json.bqn` for more details.I've currently only used it for parsing JSON (handily just downloaded via curl...), so the facility for writing or mutating JSON objects
is as-yet untested.Example:
```
json ← •Import "bqn-bindings/json.bqn"
object ← json.Parse "{ ""a"": [1, 2, 3], ""b"": [""foo"", ""bar"", ""baz""]}"
{obj‿rawtype‿typeof‿value‿readarray‿readstring‿readobject‿get‿set‿append‿keys‿values‿copy‿deepcopy‿destroy⇐}
object.TypeOf @
"object"
object.Keys @
⟨ "a" "b" ⟩
a ← object.Get "a"
{obj‿rawtype‿typeof‿value‿readarray‿readstring‿readobject‿get‿set‿append‿keys‿values‿copy‿deepcopy‿destroy⇐}
a.Value @
⟨ 1 2 3 ⟩
object.Value @
┌─
╵ "a" ⟨ 1 2 3 ⟩
"b" ⟨ "foo" "bar" "baz" ⟩
┘
json.QuickParse "{ ""a"": [1, 2, 3], ""b"": [""foo"", ""bar"", ""baz""]}"
┌─
╵ "a" ⟨ 1 2 3 ⟩
"b" ⟨ "foo" "bar" "baz" ⟩
┘
```