Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send binary data with HTTPPOST option #407

Closed
juanch120 opened this issue Jan 25, 2024 · 1 comment
Closed

Send binary data with HTTPPOST option #407

juanch120 opened this issue Jan 25, 2024 · 1 comment
Labels

Comments

@juanch120
Copy link

I've tried for hours and hours to send a data-form POST method with binary data like this:

const formData: [{ name: 'file', content: *BINARY DATA* }]
curl.setOpt('HTTPPOST', formData)

but node-libcurl HTTPPOST 'content' field only accepts strings. Is this doable in any way? I'd like to be able to replicate this:

const formData = new FormData()
formData.append('file', new Blob([rawDataBuffer]), 'title')
const response = await fetch(url, { body: formData, method: 'POST' })
@JCMais
Copy link
Owner

JCMais commented Feb 13, 2024

The only way to do this right now is by writing the contents to a file or using the READFUNCTION option to build the parsing directly.

There is an open ticket to support the mime apis here: #112

which could help this use case, but I cannot say when I will be able to work on that.

@JCMais JCMais closed this as completed Feb 13, 2024
@JCMais JCMais added the feature label Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants