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

svgl-client

v0.1.2

Published

A simple Node.js client for the SVGL API (https://svgl.app)

Downloads

13

Readme

SVGL API Client

A simple Node.js client library for interacting with the SVGL API. Fetch SVG logo information easily in your TypeScript or JavaScript projects.

npm version

Installation

npm install svgl-client
# or
yarn add svgl-client

Usage

Import the necessary functions from the package:

import {
  getSvgs,
  getSvgsByCategory,
  getCategories,
  searchSvgs,
  // Types (optional)
  iSVG,
  Category
} from 'svgl-client';

// Example usage:

// Get all SVGs
async function fetchAllSvgs() {
  try {
    const svgs: iSVG[] = await getSvgs();
    console.log('All SVGs:', svgs.slice(0, 5)); // Log first 5
  } catch (error) {
    console.error('Error fetching all SVGs:', error);
  }
}

// Get a limited number of SVGs
async function fetchLimitedSvgs(limit: number) {
  try {
    const svgs: iSVG[] = await getSvgs(limit);
    console.log(`Limited SVGs (first ${limit}):`, svgs);
  } catch (error) {
    console.error('Error fetching limited SVGs:', error);
  }
}

// Get SVGs by category
async function fetchSvgsByCategory(categoryName: string) {
  try {
    const svgs: iSVG[] = await getSvgsByCategory(categoryName);
    console.log(`SVGs in category "${categoryName}":`, svgs.slice(0, 5)); // Log first 5
  } catch (error) {
    console.error(`Error fetching SVGs for category ${categoryName}:`, error);
  }
}

// Get all categories
async function fetchCategories() {
  try {
    const categories: Category[] = await getCategories();
    console.log('All Categories:', categories);
  } catch (error) {
    console.error('Error fetching categories:', error);
  }
}

// Search SVGs by name
async function searchSvgsByName(query: string) {
  try {
    const svgs: iSVG[] = await searchSvgs(query);
    console.log(`Search results for "${query}":`, svgs);
  } catch (error) {
    console.error(`Error searching for SVGs with query "${query}":`, error);
  }
}

// --- Run examples ---
fetchAllSvgs();
fetchLimitedSvgs(10);
fetchSvgsByCategory('Software');
fetchCategories();
searchSvgsByName('axiom');

API

  • getSvgs(limit?: number): Promise<iSVG[]>: Fetches all SVGs or a limited number.
  • getSvgsByCategory(category: string): Promise<iSVG[]>: Fetches SVGs filtered by a specific category name.
  • getCategories(): Promise<Category[]>: Fetches all available categories and the count of SVGs in each.
  • searchSvgs(query: string): Promise<iSVG[]>: Searches for SVGs by name.

Types

The package exports the following TypeScript types:

  • iSVG: Interface representing an SVG object.
interface iSVG {
  id?: number;
  title: string;
  category: tCategory | tCategory[];
  route: string | ThemeOptions;
  wordmark?: string | ThemeOptions;
  brandUrl?: string;
  url: string;
}
  • Category: Interface representing a category object.
interface Category {
  category: string;
  total: number;
}
  • ThemeOptions: Type for theme-specific routes/wordmarks.
type ThemeOptions = {
  dark: string;
  light: string;
};
  • tCategory: Type representing the category name (currently string).

Testing

This package uses Jest for testing.

  • Mock Tests (Default): These tests run quickly using mocked API responses and do not hit the live SVGL API. Run them with:
    npm test
  • Live Integration Tests: These tests make actual requests to the SVGL API to ensure real-world integration. They are slower and may be subject to rate limiting by the API. Run them sequentially with:
    npm run test:live

Limitations

  • The SVGL API is rate-limited. Please use responsibly.
  • Per the API owner: "Don't use the API for create the same product as SVGL. The API is intended to be used for extensions, plugins, or other tools that can help the community."

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

MIT