# Deno Standard Library

Deno Standard Library 不是运行时全局 API 的集合，而是一组发布在 JSR `@std` scope 下、独立版本化的模块。只安装项目实际使用的包：

```bash
deno add jsr:@std/path jsr:@std/fs jsr:@std/assert
```

```ts
import { join } from "@std/path";
import { ensureDir } from "@std/fs";
import { assertEquals } from "@std/assert";

await ensureDir(join("data", "cache"));
assertEquals(join("data", "file.txt"), "data/file.txt");
```

## 常用包

| 任务 | 包 | 备注 |
| --- | --- | --- |
| 跨平台路径 | `@std/path` | 不要手拼 `/` |
| 文件系统辅助 | `@std/fs` | 仍受 Deno 文件权限控制 |
| 测试断言 | `@std/assert` | 与 `Deno.test` 配合 |
| 日期时间 | `@std/datetime` | JSR 标注 UNSTABLE 且未随 std 1.0 稳定化；优先 Web `Temporal` / `Intl` |
| UUID | Web `crypto.randomUUID()` | 通常不需要额外包 |
| HTTP | `Deno.serve` | 路由、session 等再选框架 |

标准库包没有第三方依赖，并尽量跨 Deno、Node、Bun、Workers 和浏览器工作；真正可移植范围仍取决于底层平台 API。

官方参考：[Deno Standard Library](https://docs.deno.com/runtime/reference/std/)、[JSR @std](https://jsr.io/@std)。
