Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

436
Views
convert cURL command to http put request

i need to convert the following cURL command:

curl --request PUT \
--url https://storage.bunnycdn.com/storage/path/index.jpeg \
--header 'AccessKey: <AccessKey>' \
--header 'Content-Type: application/octet-stream' \
--data-binary @/home/path/to/index.jpeg

which sends a put request with an image to be uploaded to a CDN

to an https put request, specially with the --data-binary

i tried :

   try {
                  var request = new http.MultipartRequest("PUT", uri);
                  request.headers.addAll({
                    'content-type': 'multipart/form-data',
                    'AccessKey': '<AccessKey>',
                  });

                  request.files.add(
                    await http.MultipartFile.fromPath(
                      'file',
                      _image.path,
                      filename: fileName,
                    ),

                  );

                  var response = request.send().then((value) => setState(() {
                        isLoading = false;
                      }));
                } catch (e) {
                  print(e);
                }

but unfortunately the file arrives at the CDN storage with wrong formatting.

how can i upload the image with http put request as --data-binary

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use postman to convert curl to some languages, to javascript postman return this:

var request = require('request');
var options = {
  'method': 'PUT',
  'url': 'https://storage.bunnycdn.com/storage/path/index.jpeg',
  'headers': {
    'AccessKey': '<AccessKey>',
    'Content-Type': 'application/octet-stream'
  },
  body: '@/home/path/to/index.jpeg'

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

This is just a example, so if you need something more elaborated do it.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!