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

vcloud-fe-utils

v1.0.0

Published

A collection of useful browser utilities and tools

Readme

vcloud-fe-utils

一个通用的浏览器工具库集合,提供各种实用的工具函数和类。

功能特性

  • 🎯 TypeScript支持 - 完整的类型定义
  • 📦 零依赖 - 不依赖任何第三方库
  • 🚀 轻量级 - 体积小,性能优秀
  • 🔧 模块化 - 按需导入,支持Tree Shaking

安装

npm install vcloud-fe-utils
# 或
yarn add vcloud-fe-utils
# 或
pnpm add vcloud-fe-utils

功能模块

🎤 音频录制 (WavRecorder)

高质量音频录制和WAV格式转换工具。

基本使用

import { WavRecorder } from 'vcloud-fe-utils'

// 创建录音器实例
const recorder = new WavRecorder()

// 开始录音
try {
  await recorder.startRecording()
  console.log('录音已开始')
} catch (error) {
  console.error('无法访问麦克风:', error)
}

// 停止录音并获取Base64格式的WAV音频
try {
  const base64Audio = await recorder.stopRecording()
  console.log('录音完成,音频数据长度:', base64Audio.length)
  
  // 保存为本地文件
  WavRecorder.saveBase64AsWavFile(base64Audio, 'my-recording.wav')
} catch (error) {
  console.error('录音处理失败:', error)
}

完整示例

import { WavRecorder } from 'vcloud-fe-utils'

class AudioRecorder {
  private recorder: WavRecorder
  private isRecording: boolean = false

  constructor() {
    this.recorder = new WavRecorder()
  }

  // 开始录音
  async start() {
    if (this.isRecording) return
    
    try {
      await this.recorder.startRecording()
      this.isRecording = true
      console.log('🎤 录音开始')
    } catch (error) {
      console.error('❌ 无法开始录音:', error)
    }
  }

  // 停止录音
  async stop(): Promise<string | null> {
    if (!this.isRecording) return null
    
    try {
      const base64 = await this.recorder.stopRecording()
      this.isRecording = false
      console.log('✅ 录音完成')
      return base64
    } catch (error) {
      console.error('❌ 录音停止失败:', error)
      return null
    }
  }

  // 保存录音文件
  saveRecording(base64: string, filename: string = 'recording.wav') {
    WavRecorder.saveBase64AsWavFile(base64, filename)
    console.log(`💾 文件已保存: ${filename}`)
  }
}

// 使用示例
const audioRecorder = new AudioRecorder()

// 开始录音
document.getElementById('startBtn')?.addEventListener('click', () => {
  audioRecorder.start()
})

// 停止并保存录音
document.getElementById('stopBtn')?.addEventListener('click', async () => {
  const audioData = await audioRecorder.stop()
  if (audioData) {
    audioRecorder.saveRecording(audioData, 'my-audio.wav')
  }
})

API 文档

WavRecorder 类

实例方法:

  • startRecording(): Promise<void> - 开始录音
  • stopRecording(): Promise<string> - 停止录音并返回Base64编码的WAV音频数据
  • getRecordingState(): boolean - 获取当前录音状态
  • getChunksCount(): number - 获取已录制的数据块数量

静态方法:

  • saveBase64AsWavFile(base64: string, fileName?: string): void - 将Base64字符串保存为本地WAV文件
  • base64ToBlob(base64: string, mimeType?: string): Blob - 将Base64字符串转换为Blob对象

技术细节

  • 音频格式: 自动选择浏览器支持的最佳格式(WebM/MP4/OGG)
  • 采样率: 16kHz
  • 声道: 单声道
  • 位深: 16bit
  • 文件格式: 标准WAV格式(PCM编码)

更多功能

更多实用工具正在开发中,敬请期待!

浏览器支持

支持所有现代浏览器:

  • Chrome 50+
  • Firefox 50+
  • Safari 11+
  • Edge 79+

开发

# 克隆仓库
git clone <repository-url>

# 安装依赖
pnpm install

# 构建
pnpm build

# 开发模式(监听文件变化)
pnpm dev

# 测试
pnpm test

# 代码检查
pnpm lint

贡献

欢迎提交Issue和Pull Request!

许可证

MIT License

更新日志

v1.0.0

  • 初始版本发布
  • 添加音频录制功能(WavRecorder)
  • 支持WAV格式转换
  • 提供文件保存功能
  • 完整的TypeScript类型定义