
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
$ npm i src2img
import fs from 'node:fs/promises'
import { join } from 'node:path'
import src2img from 'src2img'
const src = `path/to/sources`
const out = `path/to/out`
const names = await fs.readdir(src)
const srcs = Promise.all(
names.map(async name => ({
name,
src: await fs.readFile(join(src, name), `utf8`),
})),
)
const images = await src2img({
// Font size and unit control the size and quality of the image.
fontSize: 20,
fontSizeUnit: `pt`,
padding: 3,
// Using 'px' does not scale with font size.
paddingUnit: `vw`,
// Png or jpeg
type: `png`,
src: srcs.map(({ src }) => [
src,
// https://prismjs.com/index.html#languages-list
`javascript`,
// See https://www.npmjs.com/package/filename2prism for getting alias from
// filename.
]),
})
await Promise.all(
images.map((image, i) =>
fs.writeFile(
join(out, `${srcs[i].name.replaceAll(/\.[^.]+$/gu, ``)}.png`),
image,
),
),
)
Look at the CLI package if you'd like to use this from the command line.
Some rendered code:

Stars are always welcome!
For bugs and feature requests, please create an issue.
FAQs
Converts source code to high quality images.
The npm package src2img receives a total of 4 weekly downloads. As such, src2img popularity was classified as not popular.
We found that src2img demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

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.