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

@mini-dev/storage-tt

v0.0.2

Published

Unified storage for Douyin mini programs: namespace, TTL, key-missing defaults, typed keys — tt platform package of @mini-dev/storage

Readme

@mini-dev/storage-tt

@mini-dev/storage 的抖音小程序平台包。本页只包含安装和抖音特有的说明,API、配置项、TTL、类型化键表等完整文档见 核心包文档。

1. 安装

npm i @mini-dev/storage-tt
  • 按抖音开发者工具的 npm 构建流程构建。
  • 使用 require 引入(CommonJS)。
  • 本包只调用 tt 全局对象,不检测运行平台。
  • 示例工程:sample-storage-douyin,可以直接用抖音开发者工具打开。

2. 最小示例

const { createStorage } = require('@mini-dev/storage-tt');

const userStore = createStorage({ namespace: 'user', defaultTtl: 7 * 24 * 3600 * 1000 });

Page({
    async onLoad() {
        await userStore.set('profile', { name: 'A' });
        const profile = await userStore.get('profile');          // { name: 'A' }
        const theme = userStore.getSync('theme', 'light');       // 键不存在时返回 'light'
    }
});

3. 抖音原生差异的处理

  • 异步读取不存在的键:官方两处口径不一致——帮助中心示例走 fail 回调(getStorage:fail data not found, key == no-exist-key),现行 API 文档正文为 success 且 data 为空字符串(2026-11 复核);两种形状本库都归一为键缺失,不返回错误信息。
  • 同步读取不存在的键:原生返回空字符串 ''(抖音 IDE 2026-11 实测;官方现行文档未载明,其错误表另列 data not found, key == %s 报错口径,与 IDE 实测不符),本库视为键缺失。
  • 键缺失时的返回值规则见核心包文档「键缺失时的返回值」。处理后,同一份代码在微信、支付宝、抖音上行为一致。

4. 抖音配额

  • 单个键最大 1MB,全部数据上限 10MB。
  • 官方说明的缓存清除时机只有三种:用户在抖音 / 头条内退出登录、用户在系统中清除 App 缓存、小程序长时间未使用触发清理。清除后读取会返回键缺失,按默认值规则处理。
  • 超出配额时,set / setSync 原样抛出原生错误。

5. 本端注意点

License

MIT