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

letter-art

v1.1.7

Published

Simple server-side ASCII art generator for Next.js with image-to-text rendering and multiple character presets.

Readme

https://www.npmjs.com/package/letter-art

A simple ASCII art rendering library that converts images into text-based representations. It maps pixel brightness to characters based on grayscale values and supports multiple character presets.

Usage (for Next.js)

Create /api/ascii/route.ts

Since letter-art performs image processing on the server side, you need to set up an API route using Next.js App Router. To set it up at the /api/ascii endpoint, create the following file:

// src/app/api/ascii/route.ts
export { GET } from "letter-art/next-api";

You are not required to use /api/ascii specifically. For example, you can configure the API route directly at /api like this:

// src/app/api/route.ts
export { GET } from "letter-art/next-api";

Use on the client

"use client";

import { AsciiArt } from "letter-art/react";

export default function Page() {
  return (
    <AsciiArt
      src="/image.jpeg"       // Must be relative to the public folder
      width={200}             // Optional: output width (default is 80)
      preset="ascii"          // Optional: character preset (see below
      endpoint="/api/ascii"   // API endpoint on the server (default: /api/ascii)
    />
    />
  );
}

Preset options

default: '@%#*+=-:. ', // default
bold: '@$B%8WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/|()1{}[]?-_+~<>i!lI;:,"^`\' ', // High detail
light: ' .:-=+*#%@', // Inverted order
blocks: '█▓▒░ ', // Unicode block style
emoji: '🤍🩶🩶🤎🖤', // heart
ascii: '#WMBRXVYIti+=~-,. ', // Classic ASCII style

Notes

src must point to a file inside the public/ folder. Internally, the server resolves it using process.cwd().

This package uses sharp, and does not run in the browser.

You must run it on the Next.js server environment (e.g., via app/api/)

Output Example


이미지를 텍스트 문자로 표현해주는 간단한 아스키 아트 렌더링 라이브러리입니다. 명암도 기반으로 픽셀을 문자로 매핑하며 몇 가지 문자 프리셋을 지원합니다.


사용법 (Next.js 기준)

1. /api/ascii/route.ts 생성

letter-art 는 서버에서 이미지 처리를 수행하므로, Next.js 의 App Router 기반 API 라우트를 설정해야 합니다. /api/ascii 엔드포인트로 설정하려면 다음과 같이 구성하세요.

// src/app/api/ascii/route.ts
export { GET } from "letter-art/next-api";

꼭 /api/ascii를 쓸 필요는 없습니다. 예를 들어, 다음처럼 API 라우트를 /api로 설정이 가능합니다.

// src/app/api/route.ts
export { GET } from "letter-art/next-api";

2. 클라이언트에서 사용

"use client";

import { AsciiArt } from "letter-art/react";

export default function Page() {
  return (
    <AsciiArt
      src="/image.jpeg"       // 반드시 public 폴더 기준 경로
      width={200}             // 선택: 출력 너비 (기본값: 80)
      preset="ascii"          // 선택: 문자 스타일 (하단 참고)
      endpoint="/api/ascii"   // 서버 API 엔드포인트 (기본값: /api/ascii)    
    />
  );
}

preset 종류

  default: '@%#*+=-:. ', // 기본값
    bold: '@$B%8WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/|()1{}[]?-_+~<>i!lI;:,"^`\' ', // 고해상도
    light: ' .:-=+*#%@', // 반전
    blocks: '█▓▒░ ', // 유니코드 블록 전용
    emoji: '🤍🩶🩶🤎🖤', // 하트
    ascii: '#WMBRXVYIti+=~-,. ', // 고전 ASCII 스타일

주의 사항

src는 반드시 public/ 폴더 기준 경로여야 하며, 내부적으로 process.cwd() 기반으로 파일을 로드합니다. 이 패키지는 sharp를 사용하므로 브라우저 환경에서는 동작하지 않습니다. Next.js 서버에서만 사용 가능합니다.