Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leokuma/decurl
Curl bindings for Deno.
https://github.com/leokuma/decurl
certificate curl deno libcurl
Last synced: 23 days ago
JSON representation
Curl bindings for Deno.
- Host: GitHub
- URL: https://github.com/leokuma/decurl
- Owner: Leokuma
- License: mit
- Created: 2023-10-16T13:58:10.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-19T14:12:03.000Z (8 months ago)
- Last Synced: 2024-10-14T02:01:08.924Z (23 days ago)
- Topics: certificate, curl, deno, libcurl
- Language: TypeScript
- Homepage: https://deno.land/x/decurl
- Size: 2.79 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Decurl
[Curl](https://curl.se/libcurl/) bindings for Deno.The goal of this library is not to provide an ergonomic layer on top of Curl, but to provide a 1:1 usage and feature parity with Curl with a few convenient helpers.
```ts
import Decurl, { globalInit, globalCleanup } from 'https://deno.land/x/decurl/decurl.ts'globalInit()
using decurl = new Decurl()
decurl.setSslVerifypeer(0)
decurl.setUrl('https://example.com')const curlCode = decurl.perform()
const responseCode = decurl.getResponseCode()
const response = decurl.getWriteFunctionData()if (response) {
console.log(new TextDecoder().decode(response))
}console.log(responseCode)
console.log(curlCode)globalCleanup()
```Run with `deno run -A --unstable`.
More examples in the `tests` folder.
## Requirements
- Deno >= 1.37.1[1]
- Curl >= 7.73.0[2][1] You can use older versions of Deno as well, but then you will have to call the method [`Decurl.cleanup()`](https://curl.se/libcurl/c/curl_easy_cleanup.html) manually because you won't be able to use [`using`](https://devblogs.microsoft.com/typescript/announcing-typescript-5-2/#using-declarations-and-explicit-resource-management).
[2] On Windows you probably won't need to install Curl as Decurl will download and cache [`libcurl.dll`](https://deno.land/x/decurl/lib/libcurl-x64.dll) automatically on first execution.
## Roadmap
- Async operations.