{"id":14990022,"url":"https://github.com/lsevero/clj-curl","last_synced_at":"2025-04-12T02:03:29.766Z","repository":{"id":62431440,"uuid":"210230111","full_name":"lsevero/clj-curl","owner":"lsevero","description":"curl for clojure","archived":false,"fork":false,"pushed_at":"2020-03-24T17:34:49.000Z","size":59,"stargazers_count":28,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-12T02:03:10.894Z","etag":null,"topics":["clojure","curl","dict","ftp","gopher","http","imap","jna","ldap","libcurl","pop3","rtmp","rtsp","scp","sftp","smb","smtp","telnet","tftp"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lsevero.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-22T23:55:48.000Z","updated_at":"2023-02-08T19:04:24.000Z","dependencies_parsed_at":"2022-11-01T20:46:44.296Z","dependency_job_id":null,"html_url":"https://github.com/lsevero/clj-curl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsevero%2Fclj-curl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsevero%2Fclj-curl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsevero%2Fclj-curl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsevero%2Fclj-curl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lsevero","download_url":"https://codeload.github.com/lsevero/clj-curl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505863,"owners_count":21115354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","curl","dict","ftp","gopher","http","imap","jna","ldap","libcurl","pop3","rtmp","rtsp","scp","sftp","smb","smtp","telnet","tftp"],"created_at":"2024-09-24T14:19:20.890Z","updated_at":"2025-04-12T02:03:29.746Z","avatar_url":"https://github.com/lsevero.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clj-curl\n\ncurl for clojure using JNA, because we love curl.\n\n[![Clojars Project](https://img.shields.io/clojars/v/clj-curl.svg)](https://clojars.org/clj-curl)\n\n## But... why?\n\nClojure definitely has excellent libraries to handle http connections like clj-http and other things, however, none of them are complete as curl.\nThere is a very good reason why curl has been ported for almost every programming language there is, because curl is just awesome.\nCurl supports a lot of protocols, like HTTP(S), FTP(S), SFTP, IMAP(S), POP3(S), TFTP, SMB, SCP, RTMP, TELNET and more, check out [protocols list](https://ec.haxx.se/protocols-curl.html) for the full list.\nThe curl's easy API is really easy. This sentence is not redundant as it appear, curl easy API is easy to use even with pure C, and it is so simple and well done that can be easily ported to other programming languages.\n\nThis library tries to be as close as possible to the C API. In case of doubts go to the examples folder and the official libcurl docs.\n\n## Usage\n\nFor obvious reasons, this project **needs libcurl to be installed in your system**.\n\nThe usage of this library is basically the same as the libcurl in C.\nEverything is mutable, so be careful. This library is just about exposing the C api to the clojure world, without adding a lot of abstractions to make things easier or doing stuff the '''clojure way'''.\nJust create a curl handler wrapped in a function without exposing the curl's state to your applications and you should be fine.\n\nDeprecated functions like `curl_formadd` will not be added here, you could implement them yourself, however if you see the official docs saying to not use a function, do yourself a favor and do not use it.\n\n## Handlers? What are they??\n\nlibcurl depends A LOT in C callbacks to do stuff (mostly reading and writing).\nThe way that the JNA creates a '''c callback''' is creating a class that implements the `Callback` interface which you should define the contents of the inherited `callback` function.\nI've created some handlers to perform some more basic and common stuff, like reading/writing from memory and reading/writing from/to files.\nEvery place that the C API asks for a C callback you should instantiate one of the Handler classes and pass its instance as a argument to `setopt`.\nPlease check the examples folder to see how to use and import them.\nThey are `gen-class` java classes, so you should import them always with the `import` clause, not `require`.\n\nAlso, besides this java handlers you could use the libc `fwrite` and `fread` to read and write to/from files, that is not recommended by the official docs because the WRITEDATA/READDATA shows some random crashes on windows. On other systems you should be fine.\n\n## Docs\n\nThree things that you should now before using this library:\n* You should use the handlers defined in `clj-curl.Handlers` instead of C Callbacks, or define your own\n* You can use plain clojure vectors instead of curl_slists when using `setopt`\n* Deprecated functions like `curl_formadd` will not be added here\n\nBesides that, there is nothing much to doc here, because we are just exposing the C curl API.\n99% of the time you will be setting some options to `setopt`, passing some handlers to read/write data and exec a `perform`.\nThe real useful docs are the official ones found at [official docs](https://curl.haxx.se/libcurl/c/), check out the examples folder and should be easy enough to read a C program and port it to the clojure interface.\n\n## TODO list\n\n* low level file descriptor functions for multi (I don't think someone will ever use one of them in a high level language like clojure though)\n\n## License\n\nCopyright © 2019\n\nThis program and the accompanying materials are made available under the\nterms of the Eclipse Public License 2.0 which is available at\nhttp://www.eclipse.org/legal/epl-2.0.\n\nThis Source Code may also be made available under the following Secondary\nLicenses when the conditions for such availability set forth in the Eclipse\nPublic License, v. 2.0 are satisfied: GNU General Public License as published by\nthe Free Software Foundation, either version 2 of the License, or (at your\noption) any later version, with the GNU Classpath Exception which is available\nat https://www.gnu.org/software/classpath/license.html.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsevero%2Fclj-curl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flsevero%2Fclj-curl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsevero%2Fclj-curl/lists"}