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

assets-encrypt

v1.0.1

Published

资源文件加密

Readme

项目资源加密、解密脚本, 小游戏资源加密部分实现

已实现功能:

  • 对项目中各种资源进行加密、解密, 包括图片、文本、音视频, 有更多类型的资源需要加密可以在项目中扩展
  • 此项目是衍生自小游戏加固需求, 目前针对 cocos2.4.12 引擎集成了自动化注入解密插件脚本的功能, 实现在引擎发布到微信小游戏平台后, 在小游戏运行时进行动态解密

待实现功能

  • 支持指定需要加密的资源类型
  • 兼容 cocos 引擎其他版本的解密方案, 以及其他引擎的解密方案(laya, egret, unity)

动态解密原理:

梳理了下 cocos2.4.12 引擎资源加载流程:

  1. 资源下载(本地、缓存、网络)
  2. 资源解析
  3. 资源加载

只需要在资源下载完成后, 在进入资源解析的流程时, 进行资源解密即可, 这样在资源加载的时候加载的就是解密后的资源.

图片资源解密举例: 在图片资源下载到本地路径后, 可以根据路径拿到图片的加密数据, 然后在图片解析的流程中,将图片数据解密为 base64 编码, 最后将解密后的 base64 编码赋值给图片内存对象的 src 属性去加载即可. 具体代码实现可以参考decryptPlugin.js文件内容.

使用方式

  1. 本地项目测试可以直接运行 package.json 文件中的 script 脚本, 具体测试代码在test.ts文件中修改
# 资源加密
$ yarn test-enc
# 资源解密
$ yarn test-dec
  1. 接入到现有项目测试可使用 yalc 工具模拟 npm 包导入到项目中进行测试, 导入后只需按test.ts文件中的写法来使用即可

  2. 接入到现有项目且投入线上使用需将此项目打包发布到 npm 后导入使用