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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@little-dash/utils

v0.1.1

Published

Shared utilities for littledash applications

Readme

@littledash/utils

Shared utilities for building littledash applications.

Installation

yarn add @littledash/utils
# or
npm install @littledash/utils

Features

Image Utilities

Convert PNG images to RGB565 format for display on littledash devices:

import { loadPngAsRgb565, loadPngAsElement } from "@littledash/utils/image";

// Load and convert image
const imageData = await loadPngAsRgb565("./logo.png", 100, 50);

// Or get a ready-to-use display element
const element = await loadPngAsElement("./logo.png", 10, 10, 100, 50);

Device Configuration

Configure littledash devices with WiFi credentials and server URL:

import { configureDevice } from "@littledash/utils/configure-device";

await configureDevice({
  serverUrl: "http://192.168.1.100:3000",
  envPath: "./.env", // optional
});

Or use the CLI:

# Auto-detect server URL
yarn littledash-configure

# Specify server URL
yarn littledash-configure 192.168.1.100:3000

Usage in Your Project

1. Update package.json

{
  "dependencies": {
    "@littledash/utils": "file:../../packages/littledash-utils"
  },
  "scripts": {
    "configure-device": "littledash-configure"
  }
}

2. Update your imports

Replace local imports with the package:

// Before
import { loadPngAsRgb565 } from "./utils/image.js";

// After
import { loadPngAsRgb565 } from "@littledash/utils/image";

3. Use the configure-device script

yarn configure-device

API

Image Functions

loadPngAsRgb565(filePath, targetWidth?, targetHeight?)

Loads a PNG file and converts it to RGB565 format.

Parameters:

  • filePath (string): Path to PNG file
  • targetWidth (number, optional): Target width for resizing
  • targetHeight (number, optional): Target height for resizing

Returns: Promise<{ data: string; width: number; height: number }>

loadPngAsElement(filePath, x, y, targetWidth?, targetHeight?)

Loads a PNG and returns a display element configuration.

Parameters:

  • filePath (string): Path to PNG file
  • x (number): X position on display
  • y (number): Y position on display
  • targetWidth (number, optional): Target width for resizing
  • targetHeight (number, optional): Target height for resizing

Returns: Display element object

Configuration Functions

configureDevice(options?)

Configures a littledash device via serial connection.

Parameters:

  • options.serverUrl (string, optional): Server URL to configure
  • options.envPath (string, optional): Path to .env file

Returns: Promise<void>

runConfigureDeviceCLI()

CLI entry point for device configuration. Reads from .env and command line arguments.

Environment Variables

Create a .env file in your project root:

WIFI_SSID=your_wifi_ssid
WIFI_PASSWORD=your_wifi_password
PORT=3000

License

MIT