npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dooboostore/lib-node

v1.0.6

Published

dooboostore library for node

Readme

@dooboostore/lib-node

NPM version Build and Test License: MIT

Full Documentation: https://dooboostore-develop.github.io/@dooboostore/lib-node

A Node.js utility package for generating random placeholder images using server-side canvas.


Features

  • Generate random image compositions with shapes (circle, rectangle, triangle, star).
  • Export as Buffer for direct upload/response pipelines.
  • Export as Base64 data URL for inline preview use cases.
  • Save output to disk with sync or async file APIs.
  • Root-first and bundle-entry import support.

Installation

# pnpm
pnpm add @dooboostore/lib-node

# npm
npm install @dooboostore/lib-node

# yarn
yarn add @dooboostore/lib-node

Public API

@dooboostore/lib-node exposes:

  • RandomImage

Import Guide

Root import (recommended)

import { RandomImage } from '@dooboostore/lib-node';

Bundle entry import

import { RandomImage } from '@dooboostore/lib-node/bundle-entry';

Basic Usage

import { RandomImage } from '@dooboostore/lib-node';
import * as path from 'path';

async function generateImage() {
  const randomImage = new RandomImage();
  const filePath = path.join(__dirname, 'my-random-image.png');

  await randomImage.writeFile({
    path: filePath,
    size: { w: 200, h: 200 },
    mimeType: 'image/png'
  });

  console.log(`Image saved to ${filePath}`);
}

generateImage();

API Reference

RandomImage

buffer(config)

Returns image bytes as Buffer.

const image = new RandomImage();
const buffer = image.buffer({
  size: { w: 400, h: 240 },
  mimeType: 'image/png'
});

base64(config)

Returns a Base64 data URL string.

const image = new RandomImage();
const base64 = image.base64({
  size: { w: 300, h: 300 },
  mimeType: 'image/jpeg',
  quality: 0.9
});

writeFile(config)

Writes image to disk asynchronously.

await new RandomImage().writeFile({
  path: './out/random-image.png',
  size: { w: 512, h: 512 },
  mimeType: 'image/png'
});

writeFileSync(config)

Writes image to disk synchronously.

new RandomImage().writeFileSync({
  path: './out/random-sync.jpg',
  size: { w: 256, h: 256 },
  mimeType: 'image/jpeg'
});

Configuration Shape

All methods use a variant of this config:

{
  size: { w: number; h: number; },
  mimeType?: 'image/png' | 'image/jpeg',
  quality?: number,        // only for jpeg base64 output
  path?: string            // required for writeFile/writeFileSync
}

Typical Use Cases

  • Generating placeholder images for test fixtures.
  • Producing random thumbnails for QA/demo data.
  • Returning generated image data from Node HTTP endpoints.
  • Batch image generation in scripts.

Troubleshooting

Issue: canvas install/build fails on CI or local machine
Solution: install platform build dependencies required by canvas before package install.

Issue: Output looks too compressed in JPEG mode
Solution: raise quality value in base64({ mimeType: 'image/jpeg', quality }).

Issue: File write fails with ENOENT
Solution: create parent directories before calling writeFile/writeFileSync.

Learn More

The detailed API documentation is available on our documentation website.

Related Packages

License

This package is licensed under the MIT License.