@renovatebot/osv-offline

中文文档
4.5.7发布于 2026/11/02MITES Module构建来源已验证
原始使用文档
文档目录5 节
  1. Environment variables
  2. Split format
  3. Without internet access
  4. Logging
  5. License

osv-offline

Package version Build status MIT license

Environment variables

NameDescriptionDefault
OSV_OFFLINE_ROOT_DIRDirectory of the downloaded databases<tmpdir>/osv-offline
OSV_OFFLINE_DATABASE_FORMATzip downloads all databases as one zip; split downloads each ecosystem on its first query, and again only when it changedzip
OSV_OFFLINE_DATABASE_URLURL of the database ziphttps://github.com/renovatebot/osv-offline/releases/latest/download/osv-offline.zip
OSV_OFFLINE_DATABASE_INDEX_URLURL of the index.json of the split formathttps://renovatebot.github.io/osv-offline/v2/index.json
OSV_OFFLINE_DISABLE_DOWNLOADSet to true to use the databases in OSV_OFFLINE_ROOT_DIR without downloading them-
OSV_OFFLINE_MAX_AGEHow old the downloaded databases may be before they are downloaded again, as an ms duration such as 30m, 4h or 7d1d

Split format

With OSV_OFFLINE_DATABASE_FORMAT=split, the databases are downloaded from the release of the latest database update (https://github.com/renovatebot/osv-offline/releases/download/1-<yyyyMMddHHmmss>/), as listed by the index on https://renovatebot.github.io/osv-offline/. When outgoing traffic is restricted, allow github.com, release-assets.githubusercontent.com (where the downloads redirect to) and renovatebot.github.io.

To mirror the split format, copy index.json without its baseUrl and the files it lists into one directory, and set OSV_OFFLINE_DATABASE_INDEX_URL to the mirrored index.json. Files are resolved relative to the index then.

Without internet access

These variables also apply to Renovate's osvVulnerabilityAlerts, which uses this package.

osv-offline downloads the databases again once they're older than OSV_OFFLINE_MAX_AGE, one day by default. Set OSV_OFFLINE_DISABLE_DOWNLOAD=true to turn that off.

To use an internal mirror, copy osv-offline.zip from the latest release to an internal web server and set OSV_OFFLINE_DATABASE_URL to the copy. The databases are downloaded from there again after OSV_OFFLINE_MAX_AGE.

Without any downloads, extract the databases yourself and disable the download:

export OSV_OFFLINE_ROOT_DIR=/var/lib/osv-offline
export OSV_OFFLINE_DISABLE_DOWNLOAD=true
unzip -o osv-offline.zip -d "$OSV_OFFLINE_ROOT_DIR"
  • OSV_OFFLINE_ROOT_DIR needs one <ecosystem>.nedb per ecosystem, e.g. npm.nedb; the <ecosystem>.idx.json next to it is optional but recommended, as it makes opening the database about four times faster
  • to update while Renovate runs, extract a newer zip into a temporary directory on the same file system and move the files into OSV_OFFLINE_ROOT_DIR, the .idx.json files before the .nedb files, so no database is read while it's written

Logging

The packages log to the logger set with configure({ logger }) of @containerbase/base, eg. a pino or Renovate logger. Their messages start with OSV:, eg. for Renovate's logLevelRemap. Without one, they log through debug (namespace osv-offline:*).

License

This package is licensed under the MIT license.

Vulnerabilities are provided from the following upstream data sources and licenses:

版本与发布记录

@renovatebot/osv-offline 共发布 124 个版本,首次发布于 2022/09/14;过去 12 个月发布了 47 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
4.5.7latest2026/11/021 天前
4.5.62026/11/021 天前
4.5.52026/11/021 天前
4.5.42026/11/012 天前
4.5.32026/11/012 天前
4.5.22026/10/313 天前

其他发布通道:next → 1.7.7-next.1。

关于 @renovatebot/osv-offline 的常见问题

如何安装 @renovatebot/osv-offline?

在项目目录运行 npm install @renovatebot/osv-offline,或使用 pnpm add / yarn add / bun add。

@renovatebot/osv-offline 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/renovatebot__osv-offline 是否存在。

@renovatebot/osv-offline 支持 ESM 还是 CommonJS?

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

@renovatebot/osv-offline 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24.11.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@renovatebot/osv-offline 可以商用吗?

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

@renovatebot/osv-offline 还在维护吗?

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