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

173
Views
cómo obtener el valor de la función reader.load

tengo una función getHash en la que estoy pasando el archivo para obtener el hash.

 function getHash(data) { console.log(data); const [file] = data; console.log(file); const reader = new FileReader(); let dataHash ; reader.onload = () => {dataHash=md5(reader.result),console.log(dataHash)}; if (file) { reader.readAsText(file); } console.log(dataHash); return dataHash;

}

entonces lo estoy llamando dentro de otra función, pero ¿cómo obtendré el valor de dataHash en la función en la que lo estoy llamando?

 FIRMWARE.uploadFiles = (body, index) => { body.size += body.data[index].size; let bodyData = body.data; console.log(typeof (bodyData)); console.log(bodyData[1]); let fileHash = []; let hash = ''; getHash(bodyData); // console.log(hash); // fileHash.push(hash); if (bodyData.length = 2) { const dt = new DataTransfer(); dt.items.add(bodyData[1]); getHash(dt.files); } //console.log(dataHash); body['fileHash'] = fileHash;

quiero que el valor de hash sea devuelto por la función getHash en la siguiente función

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!