winerrjs
v0.3.6
Published
Fake error window generator in Node.js.
Maintainers
Readme
Winerr.js
Winerr.js is a library that adapts and utilizes Winerr for generating fake error windows from various versions of Windows.
Winerr typically operates as a GUI page, but I’ve made it possible to use it in code, so you can call and interact with Winerr directly, receiving either a base64 string or a buffer in return.
Important: Winerr was created by Shikoshib, and I do not take credit for the original work. Without it, there would be nothing. Winerr.js is my project, an adaptation for the JavaScript/TypeScript environment.
⚠️ Winerr.js necessarily requires one of the following packages to work: Puppeteer or Puppeteer-core.
Features
- The package supports both official Winerr and local installations, allowing you to use Winerr.js with your own builds running on your own devices.
- Generate fake Windows error windows with customizable text, buttons, and icons.
- Output images as either base64 strings or buffers.
- Supports various error window styles, including icons from different Windows versions.
Installation
You can install winerr.js using npm:
npm install winerrjsUsage
const { Winerr, SystemTypes, ButtonBuilder, ButtonTypes } = require('winerrjs');
const puppeteer = require("puppeteer");
async function generateError() {
const client = new Winerr({
"baseURL": "https://shikoshib.ru/tools/winerr", // Defaults to https://shikoshib.ru/tools/winerr if not specified
"browser": await puppeteer.launch({ headless: true }),
});
try {
const body = {
"system": "Windows_11", // Specify the system type (Windows 11 in this case)
"title": "Winerr.js", // Title of the error window
"text": "Winerr.js is a library for generating error windows in Node.js.", // Error message text
"icon": 28, // Icon id
"buttons": [
new ButtonBuilder().setType(ButtonTypes.DEFAULT).setText("Ok").build(),
new ButtonBuilder().setType(ButtonTypes.DISABLED).setText("Close").build(),
new ButtonBuilder().setType(ButtonTypes.RECOMMENDED).setText("Alt + f4").build(),
],
"frameColor": "#000000", // (only for Windows 8.0-8.1)
"primaryColor": "#FF0000", // (only for Windows 95-2000)
"secondaryColor": "#00FF00", // (only for Windows 95-2000)
"cross": false // If true, the cross is inactive,
"debug": true // Adds *some* logs
};
console.log({ ...body, "toBase64": true });
const errorBase64 = await client.image.create({ ...body, "toBase64": true });
console.log("Generated error:");
console.log(errorBase64);
// Generate the error window as a buffer (if needed for file saving or further processing)
const errorImage = await client.image.create({ ...body, "toBase64": false });
console.log("Generated error as a buffer:");
console.log(errorImage);
} catch (error) {
console.error("Error generating error window:", error);
} finally {
await client.browser.close();
}
}
generateError();And we end up with an image like this:

Saving to file
Also, saving to file was added in 2.4:
> client.image.create({ ...body, "toBase64": false, "path": "./image.png" });
> trueWith this code, it returns a Boolean. True if the save is successful, and false if it fails.
