Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/khrj/get-release-url
Deno package + CLI for fetching GitHub/BitBucket/Custom provider release + asset links with pattern matching
https://github.com/khrj/get-release-url
asset cli deno fetch github module pattern-matching release url
Last synced: 3 months ago
JSON representation
Deno package + CLI for fetching GitHub/BitBucket/Custom provider release + asset links with pattern matching
- Host: GitHub
- URL: https://github.com/khrj/get-release-url
- Owner: khrj
- License: mit
- Created: 2021-02-25T17:55:01.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-07-12T10:23:52.000Z (over 3 years ago)
- Last Synced: 2024-10-28T12:15:57.214Z (3 months ago)
- Topics: asset, cli, deno, fetch, github, module, pattern-matching, release, url
- Language: TypeScript
- Homepage: https://deno.land/x/get_release_url
- Size: 85.9 KB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
Get Release URL
Get the latest release URL from any hosting provider. Supports pattern matching
![]()
![]()
![]()
![]()
![]()
![]()
## Table of Contents
- [Usage](#usage)
- [Custom Provider Methods](#custom-provider-methods)
- [API](#api)
- [CLI](#cli)
- [Quickstart](#quickstart)
- [Installation](#installation)
- [Running](#running)## Usage
```ts
import getReleaseURL from "https://deno.land/x/[email protected]/mod.ts"const urls = await getReleaseURL({
provider: "github",
user: "phhusson",
repo: "treble_experimentations",
part: "arm64-ab-gapps",
})for (const url of urls) {
console.log(url)
}
```### Custom provider methods
Default supported providers are [GitHub](https://github.com) and [BitBucket](https://bitbucket.org). You can add custom provider functions using `addProviderMethod` (PRs for more defaults are welcome!)
```ts
import getReleaseURL, {
addProviderMethod,
} from "https://deno.land/x/[email protected]/mod.ts"const customGithubProvider = async (
{ user, repo, part = "" }: { user: string; repo: string; part?: string },
) => {
const response = await fetch(
`https://api.github.com/repos/${user}/${repo}/releases/latest`,
)
const json = await response.json()if (json.message === "Not Found") throw new Error("Invalid repository")
if (!("assets" in json)) throw new Error("Rate limit exceeded")let browser_download_urls: string[] = json.assets.map((
asset: { browser_download_url: string },
) => asset.browser_download_url)
return browser_download_urls.filter((url) => url.includes(part))
}addProviderMethod("github", customGithubProvider)
await getReleaseURL({
provider: "github",
user: "phhusson",
repo: "treble_experimentations",
part: "arm64-ab-gapps",
}) // Uses custom method
```### API
See [generated documentation](https://doc.deno.land/https/deno.land/x/[email protected]/mod.ts)
## CLI
### Quickstart
```bash
deno run --allow-net https://deno.land/x/[email protected]/get-release-url.ts github phhusson treble_experimentations arm64-aonly
```### Installation
```bash
deno install --allow-net https://deno.land/x/[email protected]/get-release-url.ts
```### Running
```bash
get-release github phhusson treble_experimentations arm64-aonly
```### Usage
```
Usage: get-release (github|bitbucket) user repo [partofreleasefile]
Ex: get-release github phhusson treble_experimentations
get-release github phhusson treble_experimentations arm64-ab-gapps
get-release bitbucket JesusFreke smali
get-release bitbucket JesusFreke smali baksmali
```## Supporters
[![Stargazers repo roster for @khrj/get-release-url](https://reporoster.com/stars/khrj/get-release-url)](https://github.com/khrj/get-release-url/stargazers)
[![Forkers repo roster for @khrj/get-release-url](https://reporoster.com/forks/khrj/get-release-url)](https://github.com/khrj/get-release-url/network/members)
## Related
- [Deno modules](https://github.com/khrj/deno-modules)