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

@thankin/thumbnail-generator

v0.2.1

Published

thumbnail-generator

Readme

ThumbnailGenerator

每个人电脑里面都存了n个G的照片,如今一张照片轻松大于10M,各看图软件打开拥有几十个文件的目录的时候,都会加载很长时间。而当缓存被清除等各种原因,下次访问的时候,又需要重新加载一次。当一个目录下有几百张大于100M的照片时,我们想在这么多照片中,找到想要的那一张……那简直是灾难。

而将这些照片生成很小的缩略图,我们找照片的时候,只在缩略图内找,找到想要的,再去源目录中查看,速度会快很多。于是有了这么一个简单的小项目。

Useage


npm i -S @thankin/thumbnail-generator

import{ConfigS,genThumbnail} from '@thankin/thumbnail-generator'

const config=new ConfigS();
config.srcArr.push('D:/photo');
config.srcArr.push('E:/work-photo');
config.dist='D:/thumbnail';
config.ffmpegPath='C:/Program Files/ffmpeg/ffmpeg-2021-07-27/bin/ffmpeg.exe';
config.gswinPath='C:/Program Files/gs9.54.0/bin/gswin64c.exe';
genThumbnail(config);

按照以上示例代码,会将D:/photo和E:/work-photo下面的所有照片、视频(包含子目录),都生成缩略图到D:/thumbnail目录下,缩略图目录为D:/thumbnail/photo & D:/thumbnail/work-photo。支持HEIC、常规图片格式,以及ffmpeg支持的各种视频格式。ffmpeg需要自行下载。

Features

  • 使用sharp生成图片缩略图
  • 使用ffmpeg生成视频缩略图
  • 使用ghost script生成pdf缩略图

缩略图格式为webp。我测试下来同等质量下,这是占用空间最小的文件格式。如果图片数量多,那么生成会需要很长时间,取决于电脑性能,做好等几个小时的准备。当然可以随时停止,会自动跳过已经存在缩略图的文件。

TODO

缩略图的各种参数暂不支持自定义。部分少见的文件格式会不支持。有人帮忙最好。目前的代码我自己用是够了。如果以后能支持其他格式生成缩略图就更好了,例如word、PowerPoint等。

有问题直接提交issue。