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

175
Views
web serial api readable stream code not work well
 while (true) {
    let { value, done } = await reader.read();
    if (done) {
      // |reader| has been canceled.
      console.log("brack");
      break;
    }
    console.log(value);
    console.log()
  }
} catch (error) {
  // Handle |error|...
} finally {
  reader.releaseLock();
  console.log("f1");
}

}

when I read data from the serial port, my whole data is perfectly received, but the value of the "done" variable never changes it remains false and the code is stop on this stage " let { value, done } = await the reader.read();".

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

0

Unless the serial port encounters an error you will always be able to read more data and so done is never set to true. If your program has read all the data it intends to then it should stop calling read() until it wants to receive more data. Note, if the device sends more data than the buffer size specified when opening the port this data may be lost if your application isn't calling read() to pull it out of the buffer.

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!