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

@casfa/storage-fs

v0.3.0

Published

File system storage provider for CAS

Readme

@casfa/storage-fs

基于文件系统的 CAS 存储提供者。

安装

bun add @casfa/storage-fs

概述

基于文件系统的 CAS(内容寻址存储)存储提供者。采用分片目录结构存储内容,以获得更好的文件系统性能。

存储结构

{basePath}/
├── ab/
│   └── cd/
│       └── abcd1234...  (full hash)
├── ef/
│   └── 01/
│       └── ef012345...
└── ...

使用方法

基本用法

import { createFsStorage } from '@casfa/storage-fs';

const storage = createFsStorage({
  basePath: '/var/cas/data',
});

// 存储数据
await storage.put('node:abcd1234...', data);

// 检索数据
const data = await storage.get('node:abcd1234...');

配置

interface FsStorageConfig {
  // 必需:存储基础目录
  basePath: string;
  
  // 可选:文件权限(默认: 0o644)
  fileMode?: number;
  
  // 可选:目录权限(默认: 0o755)
  dirMode?: number;
}

API 参考

函数

  • createFsStorage(config) - 创建文件系统存储

StorageProvider 接口

interface StorageProvider {
  get(key: string): Promise<Uint8Array | null>;
  put(key: string, data: Uint8Array): Promise<void>;
}

性能建议

  1. 使用缓存 以应对读密集型工作负载
  2. 使用 SSD 存储 以获得更好的随机访问性能
  3. 监控磁盘空间,因为 CAS 数据本质上是只追加的
  4. 考虑为 CAS 数据使用独立分区,防止占满系统磁盘

相关包

  • @casfa/storage-core - 核心类型与工具
  • @casfa/storage-memory - 内存存储(用于测试)
  • @casfa/storage-s3 - S3 存储(用于云端部署)

许可证

MIT