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

@persian-caesar/hycom-api

v1.1.6

Published

A package for easy using hycom.ir api service.

Readme

HyCom API

A lightweight TypeScript client for the HyCom public API. This package provides convenient functions to fetch authors, posts, tags, site statistics, and QR codes, handling all network requests internally.


Features

  • Fetch top authors by views
  • Retrieve posts by author
  • List popular tags
  • Explore and search posts with pagination and sorting
  • Get site-wide statistics
  • Generate QR codes for any URL

Installation

Install via npm or yarn:

npm install @persian-caesar/hycom-api
# or
yarn add @persian-caesar/hycom-api

Quick Start

import {
  topAuthors,
  authorPosts,
  getTags,
  explore,
  websiteInformation,
  lastPosts,
  qrCode
} from '@persian-caesar/hycom-api';

async function main() {
  // 1. Get top 5 authors by view count
  const authors = await topAuthors(5);
  console.log('Top Authors:', authors);

  // 2. Retrieve latest posts by a specific author
  const postsByAuthor = await authorPosts('SobhanSRZA-1637', 10, 'newest');
  console.log("John Doe's Posts:", postsByAuthor);

  // 3. List 15 most popular tags
  const tags = await getTags(15);
  console.log('Tags:', tags);

  // 4. Explore posts: page 2, sorted by most viewed, filtered by 'javascript'
  const exploreResults = await explore('', 2, 12, 'most_viewed', 'javascript');
  console.log('Explore Results:', exploreResults);

  // 5. Fetch site information
  const siteInfo = await websiteInformation();
  console.log('Site Information:', siteInfo);

  // 6. Get the 8 most recent posts
  const recent = await lastPosts(8);
  console.log('Recent Posts:', recent);

  // 7. Generate a QR code for a URL
  const qrBuffer = await qrCode('https://example.com');
  // Save the QR buffer to disk in Node.js
  import * as fs from 'fs';
  fs.writeFileSync('qrcode.png', qrBuffer);
  console.log('QR code saved!');
}

main().catch(console.error);

Usage in JavaScript

If you're using plain JavaScript (CommonJS), import and use the library like this:

const {
  topAuthors,
  authorPosts,
  getTags,
  explore,
  websiteInformation,
  lastPosts,
  qrCode
} = require('@persian-caesar/hycom-api');

(async () => {
  try {
    // Example: fetch top 3 authors
    const authors = await topAuthors(3);
    console.log('Top 3 Authors:', authors);

    // Fetch posts by author 'jane-doe-456'
    const posts = await authorPosts('jane-doe-456', 5, 'most_viewed');
    console.log("Jane Doe's Posts:", posts);

    // List tags
    const tags = await getTags(10);
    console.log('Popular Tags:', tags);

    // Explore articles with pagination
    const exploreResults = await explore('javascript', 1, 8, 'recommended', 'nodejs');
    console.log('Explore Results:', exploreResults);

    // Site information
    const info = await websiteInformation();
    console.log('Site Info:', info);

    // Last posts
    const recent = await lastPosts(6);
    console.log('Recent Posts:', recent);

    // Generate QR code
    const qrBuffer = await qrCode('https://example.com');
    const fs = require('fs');
    fs.writeFileSync('qrcode_js.png', qrBuffer);
    console.log('QR code saved as qrcode_js.png');
  } catch (error) {
    console.error('Error:', error);
  }
})();

API Reference

| Function | Description | Parameters | Returns | | ---------------------------------------------- | -------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | | topAuthors(limit?) | Fetches authors sorted by total views | limit (number, default 10): number of authors to return (1–50) | Author[] | | authorPosts(tag, limit?, sort?) | Retrieves published posts by a given author | tag (string): display name and profile ID (e.g., "jane-doe-123")limit (number, default 10)sort ("newest", "most_viewed", default "newest") | Post[] | | getTags(limit?) | Returns tags with their associated post counts | limit (number, default 20): number of tags (1–100) | Tag[] | | explore(search?, page?, limit?, sort?, tag?) | Paginated list of articles with filtering and sorting | search (string)page (number, default 1)limit (number, default 12)sort ("recommended", "newest", "most_viewed", default "newest")tag (string) | Post[] | | websiteInformation() | Site statistics including last post, total views, posts, and authors | --- | SiteInformation | | lastPosts(limit?) | Fetches the most recent published posts | limit (number, default 10) | Post[] | | qrCode(url) | Generates a QR code image buffer for the specified URL | url (string): URL to encode | Buffer |


Types

All response data types are defined in types.ts. Key interfaces include:

  • Author: metadata about an author (name, profile ID, views)
  • Post: article information (title, summary, image, stats)
  • Tag: tag slug and post count
  • WebSiteInformation: overall site metrics
  • QrCodeResponse: raw Base64 QR code string

License

This project is licensed under the MIT License. See the LICENSE file for details.


⌨️ Built with ❤️ by Persian-Caesar. Don’t forget to ⭐️ the repo! (This project about hycom.ir by Aria developping.)

Contact