Unified fetching
- Supported backends
- C-like
- Javascript
- Web (async XMLHttpRequest)
- NodeJS (std http/https)
- Userscript (GM API)
- Sharable request caching over backends and others binaries
- Request Curl representation
Compile the same code to any backend with extra features!
Also, Unifetch provides you helpful features for development purposes
If some request isn't worked as expected for some reason, you can enable this
feature with -d:unifetchShowCurlRepr
and analyze the curl request externally!
You can enable a persistent request caching with -d:unifetchCache=/tmp/unifetchCache
.
All requests would be saved into specified directory and skip when the parameters
is exactly the same and cache exists.
In JS-web backend the cache is stored in LocalStorage, every request saves a new entry
import pkg/unifetch
echo fetch "https://example.com"
or
import pkg/unifetch
let
uni = newUniClient()
resp = await uni.get("https://example.com")
echo resp.body
- Javascript Backend
- Userscript (GM API)
- Implement proxy at NodeJS backend
- Add tests
- Production ready caching (without response parameters or encrypting it) with optional expiration
- Optional runtime only cache
- Disable SSL checking option for NodeJS
This library is licensed over MIT license!