Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ const childProcess = spawn(rgPath, ['abc', '.'], {
})
```

## Environment Variables

- `RIPGREP_PREBUILT_BINARIES_MIRROR`: Specify a custom mirror URL for downloading ripgrep prebuilt binaries. This is useful for users in regions where GitHub releases are slow or inaccessible, or for organizations using internal mirrors.
- **Default**: `https://github.com/microsoft/ripgrep-prebuilt/releases/download`
- **Example**: `export RIPGREP_PREBUILT_BINARIES_MIRROR=https://your-mirror.com/ripgrep-prebuilt/releases/download`
- **Note**: The mirror URL should follow the same path structure as the official repository, with binaries available at `{mirror-url}/{version}/ripgrep-{version}-{target}`

## Credits

This project is very much based on https://github.com/microsoft/vscode-ripgrep by Microsoft.
3 changes: 2 additions & 1 deletion src/downloadRipGrep.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ export const downloadRipGrep = async (overrideBinPath) => {
}
}
const target = getTarget()
const url = `https://github.com/${REPOSITORY}/releases/download/${VERSION}/ripgrep-${VERSION}-${target}`
const baseUrl = process.env.RIPGREP_PREBUILT_BINARIES_MIRROR || `https://github.com/${REPOSITORY}/releases/download`
const url = `${baseUrl}/${VERSION}/ripgrep-${VERSION}-${target}`
const downloadPath = `${xdgCache}/vscode-ripgrep/ripgrep-${VERSION}-${target}`
const binPath = overrideBinPath ?? BIN_PATH
if (!(await pathExists(downloadPath))) {
Expand Down