gnurl_mime_data(3)
π
gnurl_mime_data(3) β aka the libgnurl Manual moment
okay so bestie, welcome to the gnurl_mime_data page β¨ this is the one that lives in the libgnurl Manual, and it's literally about shoving some in-memory bytes into a mime part's body. iconic behavior, no cap π
πΈ NAME πΈ
curl_mime_data β set a mime part's body data from memory π«Ά
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_mime_data(curl_mimepart * part, const char * data , size_t
datasize);
like, that's the whole vibe. three args, one return, let's GO π
π DESCRIPTION π
curl_mime_data(3) sets a mime part's body content from memory data. that's it, that's the whole job, and it ate π₯
data points to the data bytes: those are copied to the part, so their storage may safely be reused after the call β like, you can go ahead and free/reuse your buffer, she has her own copy now, main character energy π
datasize is the number of data bytes: it can be set to CURL_ZERO_TERMINATED to indicate data is a null-terminated character string π§΅
part is the part's to assign contents to. yes, that's the actual phrasing, I'm not fixing it, she's perfect π
Setting a part's contents twice is valid: only the value set by the last call is retained β last write wins, periodt π
It is possible to unassign a part's contents by setting data to NULL π³οΈ
setting very large data is memory consuming: one might consider using curl_mime_data_cb(3) in such a case. like fr fr, if your data is huge, maybe don't hold it all in memory, that's not the slay you think it is π
π¦ AVAILABILITY π¦
As long as at least one of HTTP, SMTP or IMAP is enabled. Added in 7.56.0 β
π RETURN VALUE π
CURLE_OK or a CURL error code upon failure π
π EXAMPLE π
curl_mime *mime;
curl_mimepart *part;
/* create a mime handle */
mime = curl_mime_init(easy);
/* add a part */
part = curl_mime_addpart(mime);
/* add data to the part */
curl_mime_data(part, "raw contents to send", CURL_ZERO_TERMINATED);
look at her go, so clean, so demure πΈ
π SEE ALSO π
kk that's the page!! π this was brought to you by libcurl 7.56.0, dated 22 August 2017, and my undying love for well-documented C APIs π bye bestie, go set some mime data π¦β¨
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms