https://github.com/thisago/unifetch
Multi backend HTTP fetching
https://github.com/thisago/unifetch
fetch httpclient library multi-backend nim seamless
Last synced: 2 days ago
JSON representation
Multi backend HTTP fetching
- Host: GitHub
- URL: https://github.com/thisago/unifetch
- Owner: thisago
- License: mit
- Created: 2023-08-25T18:22:10.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-11-26T18:35:51.000Z (over 2 years ago)
- Last Synced: 2024-05-02T04:17:55.538Z (about 2 years ago)
- Topics: fetch, httpclient, library, multi-backend, nim, seamless
- Language: Nim
- Homepage:
- Size: 33.2 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: license
Awesome Lists containing this project
README
# Unifetch
#### Multi backend HTTP fetching
**[About](#about) - [Features](#features) - [Why?](#why) - [Usage](#usage)** - [License](#license)
> **Warning**
> Not all backends are implemented.
## About
Unified fetching
## Features
- Supported backends
- [x] C-like
- [x] Javascript
- [x] Web (async XMLHttpRequest)
- [x] NodeJS (std http/https)
- [ ] Userscript (GM API)
- [x] Sharable request caching over backends and others binaries
- [x] Request Curl representation
## Why?
Compile the same code to any backend with extra features!
### Development features
Also, Unifetch provides you helpful features for development purposes
#### Curl representation
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!
#### Persistent caching
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
## Usage
```nim
import pkg/unifetch
echo fetch "https://example.com"
```
or
```nim
import pkg/unifetch
let
uni = newUniClient()
resp = await uni.get("https://example.com")
echo resp.body
```
## TODO
- [ ] 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
## License
This library is licensed over MIT license!