# cloudflare-server-locations 中文文档

规范地址：https://npmcn.com/package/cloudflare-server-locations/

版本：1\.0\.33
npm 元数据更新时间：2026-11-03T06:45:25.931Z
中文译文更新时间：2026-11-03T09:02:54.985Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/cloudflare-server-locations
原文对照：https://npmcn.com/package/cloudflare-server-locations/?lang=original
项目主页：https://github.com/illusionaries/cloudflare-server-locations#readme
源码仓库：https://github.com/illusionaries/cloudflare-server-locations

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

- 包体积（解压后）：36.6 kB，6 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- 运行依赖：0 个
- peer 依赖：typescript ^5\.9\.3
- 首次发布：2026-01-04T05:45:50.525Z
- 最新版本发布：2026-11-03T06:45:25.608Z
- 已发布版本数：33（近 12 个月 33 个）

## 中文简介

[![NPM Version](https://img.shields.io/npm/v/cloudflare-server-locations)](https://www.npmjs.com/package/cloudflare-server-locations) ［![NPM Unpacked Size](https://img.shields.io/npm/unpacked-size/cloudflare-server-locations)) ([https://www.npmjs.com/packag](https://www.npmjs.com/packag)

## 安装

```sh
npm install cloudflare-server-locations
```

也可以使用：`pnpm add cloudflare-server-locations`、`yarn add cloudflare-server-locations`、`bun add cloudflare-server-locations`

## README

# Cloudflare服务器位置

[![NPM Version](https://img.shields.io/npm/v/cloudflare-server-locations)](https://www.npmjs.com/package/cloudflare-server-locations) [![NPM Unpacked Size](https://img.shields.io/npm/unpacked-size/cloudflare-server-locations)](https://www.npmjs.com/package/cloudflare-server-locations) [![NPM Downloads](https://img.shields.io/npm/dt/cloudflare-server-locations)](https://www.npmjs.com/package/cloudflare-server-locations) ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/illusionaries/cloudflare-server-locations/publish.yml)

如果您有三个字母的代码(例如，来自 `colo` 领域的 `/cdn-cgi/trace`)，并想知道它属于哪个服务器位置，这里是Cloudflare的服务器位置列表，不需要额外的网络请求。

## 用法

```typescript
import { CloudflareServerLocations } from 'cloudflare-server-locations'

console.log(CloudflareServerLocations['LAX']) // Los Angeles, CA, United States
```

## 常见问题

### cloudflare-server-locations 是什么？

［\) \(https://www\.npmjs\.com/packag

### 如何安装 cloudflare-server-locations？

在项目目录运行 npm install cloudflare-server-locations，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：typescript（^5\.9\.3）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### cloudflare-server-locations 支持 TypeScript 吗？

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

### cloudflare-server-locations 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### cloudflare-server-locations 可以商用吗？

cloudflare-server-locations 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### cloudflare-server-locations 还在维护吗？

最新版本 1\.0\.33 发布于 2026/11/03（今天）；至今共发布 33 个版本，其中过去 12 个月发布了 33 个；首次发布于 2026/01/04。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

