Skip to main content
Home

Load fresh content directly from GitHub

This package works with Cloudflare Workers, DenoIt is unknown whether this package works with Node.js, Bun, Browsers
This package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score
100%
Published
2 years ago (0.0.3)

Collected GitHub Fetch

Install

npm add @collected/github-fetch
import {
  fetchGitHubRepoRefs,
  findHEADInRefs,
  fetchGitHubRepoContent,
} from '@collected/github-fetch'

const gitHubOwner = 'cool-calm'
const repoName = 'collected-press'

const refsGenerator = fetchGitHubRepoRefs(gitHubOwner, repoName)
const head = findHEADInRefs(refsGenerator())
if (!head) {
  throw Error('No HEAD ref')
}

const response: Response = await fetchGitHubRepoContent(
  gitHubOwner,
  repoName,
  head.sha,
  'README.md',
)

// Use response:
// e.g. forward from your own server
// e.g. await response.text()
// e.g. markdownToHTML(await response.text())

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@collected/github-fetch

Import symbol

import * as github_fetch from "@collected/github-fetch";
or

Import directly with a jsr specifier

import * as github_fetch from "jsr:@collected/github-fetch";

Add Package

pnpm i jsr:@collected/github-fetch
or (using pnpm 10.8 or older)
pnpm dlx jsr add @collected/github-fetch

Import symbol

import * as github_fetch from "@collected/github-fetch";

Add Package

yarn add jsr:@collected/github-fetch
or (using Yarn 4.8 or older)
yarn dlx jsr add @collected/github-fetch

Import symbol

import * as github_fetch from "@collected/github-fetch";

Add Package

vlt install jsr:@collected/github-fetch

Import symbol

import * as github_fetch from "@collected/github-fetch";

Add Package

npx jsr add @collected/github-fetch

Import symbol

import * as github_fetch from "@collected/github-fetch";

Add Package

bunx jsr add @collected/github-fetch

Import symbol

import * as github_fetch from "@collected/github-fetch";