Skip to content

Instantly share code, notes, and snippets.

View dsp1589's full-sized avatar
💭
Coding

dhana dsp1589

💭
Coding
View GitHub Profile
git reset --hard HEAD #reset to head commit
git clean -fdx #removes all untracked too
@dsp1589
dsp1589 / download-image.js
Created May 2, 2022 18:46
JS download image from url
async function downloadImage(imageSrc, fName) {
const image = await fetch(imageSrc)
const imageBlog = await image.blob()
const imageURL = URL.createObjectURL(imageBlog)
const link = document.createElement('a')
link.href = imageURL
link.download = fName
document.body.appendChild(link)
link.click()