Suppose I have the following code that exports a table element as a JPG using the dom-to-image library.
domtoimage.toJpeg(document.getElementById('my-node'), { quality: 0.95 })
.then(function (dataUrl) {
var link = document.createElement('a');
link.download = 'my-image-name.jpeg';
link.href = dataUrl;
link.click();
});
I'd like to save the JPG created by this code to localStorage instead of saving it on the user's device. How can this be accomplished? Thank you!