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

249
Views
how to make post request for transfer file by electron net module?

In the absence of other third-party libraries(e.g node-fetch、axios、form-data) how to make post request for transfer file by electron net module? I already know how to post data,like this:

request = net.request({
    url: 'http://localhost/xxx',
    method: 'POST'
})
request.on('response', (response) => {
    console.log(`STATUS: ${response.statusCode}`)
    console.log(`HEADERS: ${JSON.stringify(response.headers)}`)
    response.on('data', (chunk) => {
        console.log(`BODY: ${chunk}`)
    })
    response.on('end', () => {
        console.log('No more data in response.')
    })
})
request.write(data)
request.end()

but,idont know how to process formdata(origin formdata from XMLHttpRequest,not npm form-data lib),such as:

var formData = new FormData();
var myFile = document.getElementById("myFileInput");
formData.append('myFile',myFile.files[0]);

request.write(data) need the data type is string or an instance of Buffer or unit8Array,i dont know how to convert data to this type

error img

about 4 years ago · Juan Pablo Isaza
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!