
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
image-screenshot
Advanced tools
:camera: targets at browser only
Because in that way the CSS properties added to the image will be lost
There is a more famous library, html2canvas, that provides the utility of converting the DOM nodes into a picture, but it does NOT add along with the CSS properties to the pictures.
npm install --save image-screenshot
import screenshot from 'image-screenshot'
const img = document.getElementById('my-img')
screenshot(img).download()
You might need some flexibility during the process, in which you could do:
screenshot(img).then((url) => {
console.log('the base64 data url of the image is:', url)
})
Other than those, there is a helper function download that you could use elsewhere, after you get the base64 url:
import { download } from 'image-screenshot'
download(url, 'image.jpeg') // the image will be downloaded into `image.jpeg`
screenshot(img: DOMNode [, format: string, quality: float]): get the base64 url in a specific format, which is by default png. The image resolution quality is a float number that ranges from 0 to 1. The default is 0.97. The function returns a thenable object:{
url, // get the url through screenshot().url
then: callback,
download: (downloadFileName: string) => void // defaults to 'image.${format}'
}
download(url: string, fullName: string) (Note that this is different from the download function returned from screenshot)image-screenshotFAQs
> :camera: targets at **browser** only
We found that image-screenshot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.