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

class-sheet

v0.0.6

Published

Generates image from class sheet data

Readme

class-sheet

npm version Build Status XO: Linted npm

Under construction.

A package that generates image from class-sheet data.

Example

As a server with express.js:

var classSheet = require('class-sheet');

router.get('/:course_data', function (req, res, next) {
    // stream and pipe to res, send image/png result as the response
    classSheet.imageStream(req.params.course_data, res);
});

As an independent tool:

var classSheet = require('class-sheet');

// output the base64 result
console.log(classSheet.image(course_data));

Data format

A JSON string, i.e.:

course_data = '{\
  "courses":\
    [\
      {"name":"人工智能","day":0,"section":"2-4"},\
      {"name":"数据通信与计算机网络","day":2,"section":"11-12"},\
      {"name":"数据通信与计算机网络","day":0,"section":"6-8"},\
      {"name":"操作系统","day":1,"section":"8-9"},\
      {"name":"游戏开发基础","day":2,"section":"2-4"},\
      {"name":"概率论与数理统计","day":2,"section":"6-8"},\
      {"name":"第一哲学沉思集","day":3,"section":"11-12"},\
      {"name":"中文信息处理","day":3,"section":"3-4"},\
      {"name":"计算机图形学","day":4,"section":"2-4"},\
      {"name":"操作系统","day":3,"section":"6-8"},\
      {"name":"概率论与数理统计","day":4,"section":"6-7"}\
    ]\
}'

Then calling classSheet.image with course_data will get the image below (as base64 data):

1.png

Notice you can get the JSON string by calling JSON.stringify(course_object_data).

Another example:

2.png

Usage

Install

From NPM:

  • $ npm install class-sheet

From git repo:

  • install node-canvas: https://github.com/Automattic/node-canvas/wiki
  • $ git clone [email protected]:quietshu/class-sheet.git
  • $ npm install

Test

Code style:

$ npm test (current only xo.js)

Options

  • courses
    • courses data
    • default: []
    • example: [{"name":"Modern Art","day":2,"section":"1-3"}, {"name":"Computer Graphics","day":"4","section":"9-10","text-color":"red"}]
  • lines
    • horizontal lines
    • default: []
    • example: [5, 10] will drop lines under section 5 and section 10
  • custom-line-color
    • default: 'red'
  • day-content
    • default: ['一', '二', '三', '四', '五']
  • width
    • default: 320
  • height
    • default: 640
  • line-color
    • default: '#ccc'
  • text-color
    • default: '#000'
  • font-size
    • default: 12
  • info-text-color
    • default: '#555'
  • info-font-size
    • default: 10
  • background-color
    • default: '#f5f5f5'
  • header-height
    • default: 40
  • header-line-color
    • default: '#000'
  • header-text-color
    • default: '#000'
  • header-font-size
    • default: 15
  • sidebar-width
    • default: 30
  • sidebar-line-color
    • default: '#000'
  • sidebar-text-color
    • default: '#000'
  • sidebar-font-size
    • default: 12
  • days
    • default: 5
  • sections
    • default: 14
  • course-background-color
    • default: '#fff'

Acknowledgements

  • node-canvas

License

MIT.

<3