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

@ventostack/oss

v0.1.1

Published

对象存储服务:文件上传、下载、删除、签名 URL。

Readme

@ventostack/oss

对象存储服务:文件上传、下载、删除、签名 URL。

模块定位

文件存储业务模块,依赖 core、database。支持本地存储和 S3 适配器。

核心能力

  • 本地文件系统和 S3 存储适配器
  • 文件上传、下载、删除和元数据维护
  • 签名 URL 生成
  • MIME 类型和扩展名检测
  • 文件记录 Model、管理路由和数据库迁移
  • createOSSModule() 平台装配入口

安全特性

路径遍历防护

本地存储适配器 createLocalStorageAdapter 使用 resolve() + 前缀校验:

const resolved = resolve(resolvedBase, cleaned);
if (!resolved.startsWith(resolvedBase + sep) && resolved !== resolvedBase) {
  throw new Error("Path traversal detected");
}
  • 所有路径经过 resolve() 规范化后再检查前缀
  • ..、符号链接等逃逸路径被拦截
  • 写入和读取操作都做路径校验

MIME 类型检测

上传文件使用多级 MIME 检测:

  1. 请求显式声明的 contentType
  2. 文件头字节检测(detectMIME,至少 12 字节)
  3. 扩展名推断(mimeFromExtension

文件大小限制

  • 文件 Schema 支持 maxSize 约束(字节)
  • 上传大小受 HTTP 请求体大小限制保护

存储路径隔离

文件存储路径按 bucket/yyyyMMDD/uuid.ext 格式生成,不使用用户输入的文件名作为存储路径,防止文件名注入。

编码约束

  • 禁止使用用户输入直接拼接文件路径
  • 新增存储适配器必须实现路径遍历防护
  • 文件下载必须校验文件归属(uploader_id 或 bucket 约束)