salvar imagem jpg javascript

<a download="example.jpg" href="" onclick="downloadCanvas(this);">Download example.jpg</a>
async function downloadCanvas(el) {
  const imageURI = canvas.toDataURL("image/jpg");
  el.href = imageURI;
};
Stormy Sloth