# @frsource/base64 中文文档

规范地址：https://npmcn.com/package/%40frsource/base64/

版本：1\.0\.252
npm 元数据更新时间：2026-11-10T03:01:50.350Z
中文译文更新时间：2026-11-15T15:22:42.956Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40frsource/base64
原文对照：https://npmcn.com/package/%40frsource/base64/?lang=original
项目主页：http://www.webtoolkit.info/javascript_base64.html
源码仓库：https://github.com/FRSOURCE/base64

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：10 kB，7 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：0 个
- 首次发布：2022-09-23T21:16:32.785Z
- 最新版本发布：2026-11-10T03:01:49.981Z
- 近 30 天下载量：200901（2026-10-16 至 2026-11-14，npm 官方下载统计）
- 已发布版本数：251（近 12 个月 60 个）

## 中文简介

有UTF-8支持的 Base64 编码器/解码器QQ

## 安装

```sh
npm install @frsource/base64
```

也可以使用：`pnpm add @frsource/base64`、`yarn add @frsource/base64`、`bun add @frsource/base64`

## README

 [![NPM version badge](https://img.shields.io/npm/v/@frsource/base64.svg)](https://www.npmjs.com/package/@frsource/base64)[![NPM total downloads badge](https://img.shields.io/npm/dt/@frsource/base64.svg) ](https://www.npmjs.com/package/@frsource/base64)[![semantic-relase badge](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg) ](https://github.com/semantic-release/semantic-release)[![license MIT badge](https://img.shields.io/github/license/FRSOURCE/base64.svg)](https://github.com/FRSOURCE/base64/blob/main/LICENSE)

# @frsource/ base64 (英语)

这个javascript代码是用来用base64来编码/解码数据(这个编码是用来使二进制数据通过非8位清洁的运输层来活过运输). 脚本与UTF-8编码完全兼容. 可以使用base64编码数据作为简单的加密机制.

如果您计划在您的项目中使用UTF-8编码, 请不要忘记设置UTF-8( Content-Type meta tag) 的页面编码 .

## 安装

```bash
npm i @frsource/base64
```

## 使用量

```js
// 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ć
```

## 参考资料

基于webtoolkit.info执行. 原始源代码可用于: [http://www.webtoolkit.info/javascript base64.html (中文(简体) )](http://www.webtoolkit.info/javascript_base64.html)

## 许可证

[麻省理工学院](https://opensource.org/licenses/MIT)

版权(c) 2022年至今,Jakub FRS 弗赖斯勒, [资源](https://www.frsource.org/)

[![FRSOURCE logo](https://www.frsource.org/logo.jpg)](https://www.frsource.org/ "Click to visit FRSOURCE page!")

## 常见问题

### @frsource/base64 是什么？

有UTF-8支持的 Base64 编码器/解码器QQ

### 如何安装 @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 和提交记录判断。

