@frsource/base64

中文文档
1.0.252发布于 2026/11/10MITTypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 20.1万

base64 encoder/decoder with UTF-8 support 📔

原始使用文档
文档目录4 节
  1. Installation
  2. Usage
  3. References
  4. License

NPM version badge NPM total downloads badge semantic-relase badge license MIT badge

@frsource/base64

This javascript code is used to encode / decode data using base64 (this encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean). Script is fully compatible with UTF-8 encoding. You can use base64 encoded data as simple encryption mechanism.

If you plan using UTF-8 encoding in your project don’t forget to set the page encoding to UTF-8 (Content-Type meta tag).

Installation

npm i @frsource/base64

Usage

// Importing:
// typescript / ES6
import { encode, decode } from '@frsource/base64';

// legacy javscript
const { encode, decode } = require('@frsource/base64');

const encoded = encode('我喜欢解码lubię dekodować');
console.log(encoded); // output: 5oiR5Zac5qyi6Kej56CBbHViacSZIGRla29kb3dhxIc=
const decoded = decode(encoded);
console.log(encoded); // output: 我喜欢解码lubię dekodować

References

Based on webtoolkit.info implementation. Original source code available at: http://www.webtoolkit.info/javascript_base64.html

License

MIT

Copyright (c) 2022-present, Jakub FRS Freisler, FRSOURCE

FRSOURCE logo

版本与发布记录

@frsource/base64 共发布 251 个版本,首次发布于 2022/09/24;过去 12 个月发布了 60 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.0.252latest2026/11/105 天前
1.0.2512026/11/096 天前
1.0.2502026/11/0411 天前
1.0.2492026/11/0213 天前
1.0.2482026/11/0213 天前
1.0.2472026/10/2620 天前

关于 @frsource/base64 的常见问题

@frsource/base64 是什么?

base64 encoder/decoder with UTF-8 support 📔

如何安装 @frsource/base64?

在项目目录运行 npm install @frsource/base64,或使用 pnpm add / yarn add / bun add。

@frsource/base64 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@frsource/base64 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@frsource/base64 可以商用吗?

@frsource/base64 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@frsource/base64 的下载量有多少?

根据 npm 官方下载统计,@frsource/base64 在 2026/10/16 – 2026/11/14 这 30 天内被下载 200,901 次,日均约 6,697 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@frsource/base64 还在维护吗?

最新版本 1.0.252 发布于 2026/11/10(5 天前);至今共发布 251 个版本,其中过去 12 个月发布了 60 个;首次发布于 2022/09/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。