No description
Find a file
2023-11-16 02:50:19 -05:00
examples Removed unused gitignore file 2023-10-26 17:09:26 +00:00
src Added insecure opt at curl repr 2023-11-16 02:50:19 -05:00
tests init 2023-08-25 18:20:34 +00:00
.gitignore NodeJS Implementation not finished 2023-10-11 08:28:22 -03:00
changelog.md Added insecure opt at curl repr 2023-11-16 02:50:19 -05:00
config.nims init 2023-08-25 18:20:34 +00:00
license init 2023-08-25 18:20:34 +00:00
readme.md Feat: Added unsafe mode for `desktop; Fix: Removed JS warns in release mode 2023-11-08 05:39:00 +00:00
unifetch.nimble Added insecure opt at curl repr 2023-11-16 02:50:19 -05:00

Unifetch

Multi backend HTTP fetching

About - Features - Why? - Usage - License

Warning

Not all backends are implemented.

About

Unified fetching

Features

  • 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

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

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

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!