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

150
Views
How to send a file with web serial api

I am currently building a web application that allows users to type text and send an image that would be send to a laser engraver through a serial port. Now I'm stuck with a problem which is I can send a gcode string to the laser engraver but I can't send a file, so how would I send a file with Web Serial API.

let imageShow = canvas.toDataURL();
const regex = /data:.*base64,/;
console.log(imageShow.replace(regex, ""));
imageShow.replace(regex, "");       
function b64_to_utf8(str) {
     return decodeURIComponent(escape(window.atob(str)));
}
image = b64_to_utf8(imageShow);
const encoder = new TextEncoder();
const writer = port.writable.getWriter();
await writer.write(encoder.encode(image));
writer.releaseLock();
about 4 years ago · Santiago Gelvez
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!