libcurl
Nim wrapper for libcurl.
Summary
| Latest Version | Unknown |
|---|---|
| License | MIT |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:24 |
Tags
Installation
nimble install libcurl
choosenim install libcurl
git clone https://github.com/Araq/libcurl
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| libcurl | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://github.com/Araq/libcurl |
|---|---|
| Homepage | https://github.com/Araq/libcurl |
| Registry Source | nimble_official |
README
libcurl.nim
Nim wrapper for libcurl (v7.x)
libcurl v7.x
- source/binary packages - all platforms: https://curl.haxx.se/download.html
- buid instructions - all platforms: https://curl.haxx.se/docs/install.html
- binary package (.dll) - windows users: https://curl.haxx.se/windows/
basic example
import libcurl
proc curlWriteFn(
buffer: cstring,
size: int,
count: int,
outstream: pointer): int =
let outbuf = cast[ref string](outstream)
outbuf[] &= buffer
result = size * count
let webData: ref string = new string
let curl = easy_init()
discard curl.easy_setopt(OPT_USERAGENT, "Mozilla/5.0")
discard curl.easy_setopt(OPT_HTTPGET, 1)
discard curl.easy_setopt(OPT_WRITEDATA, webData)
discard curl.easy_setopt(OPT_WRITEFUNCTION, curlWriteFn)
discard curl.easy_setopt(OPT_URL, "http://localhost/")
let ret = curl.easy_perform()
if ret == E_OK:
echo(webData[])
see also: https://curl.haxx.se/libcurl/c/example.html