fastjsd CDN Mirror

DOCUMENTATION

使用文档

本站兼容 jsDelivr 的路径规则,多数场景只需替换域名即可使用。

快速迁移

将 jsDelivr 链接中的 cdn.jsdelivr.net 替换为本站域名即可:

将 jsDelivr URL 替换为本站 URL 的示例
原始替换后
https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.jshttps://fastjsd.com/npm/jquery@3.7.1/dist/jquery.min.js

其中 fastjsd.com 为本站当前域名。

支持的源与路径格式

各上游源对应的本站路径格式
本站路径格式
npm/npm/<pkg>@<ver>/<file>
unpkg/unpkg/<pkg>@<ver>/<file>
GitHub/gh/<user>/<repo>@<ref>/<file>
GitHub Raw/ghp/<user>/<repo>/<ref>/<file>
cdnjs/cdnjs/<lib>/<ver>/<file> /ajax/libs/<lib>/<ver>/<file>
WordPress/wp/plugins/<slug>/<file>/wp/themes/<slug>/<file>
npmmirror/china/<path>
esm.sh/esm/<spec>
Google Fonts/fonts/css2?family=...
Gravatar/avatar/<hash>?s=200
combine/combine/<encoded-path>,<encoded-path>

不确定路径时,可在 资源信息 页粘贴完整上游 URL(jsDelivr / unpkg / cdnjs / GitHub / raw.githubusercontent / bootcdn / googleapis / npmmirror / esm)自动转换并查看元数据。

子资源完整性 (SRI)

强烈建议为引用的资源添加 integrity 属性,浏览器会校验文件哈希,防止内容被篡改。

资源信息 页查询资源后,可复制每个文件的 SRI (integrity) 值,例如:

<script src="https://fastjsd.com/npm/jquery@3.7.1/dist/jquery.min.js"
        integrity="sha256-..."
        crossorigin="anonymous"></script>

批量替换脚本

Linux / macOS:

find src/ -type f -exec sed -i 's/cdn\.jsdelivr\.net/fastjsd.com/g' {} +

Windows (PowerShell):

Get-ChildItem -Path src -Recurse -File | ForEach-Object {
  (Get-Content $_.FullName) -replace 'cdn\.jsdelivr\.net', 'fastjsd.com' | Set-Content $_.FullName
}

说明

  • 免注册公开直通模式下无需 Token 即可访问。
  • 缓存命中缓存的资源会带 X-Cache: HIT 响应头。
  • 封禁被封禁的资源返回 HTTP 451;如需申诉或申请,请见 /apply /report