FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
jjg
jjgblockbench-plugin
Public
Like
blockbench-plugin
Home
Code
3
README.md
H
github-file-server.ts
H
inject.ts
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
5/17/2025
Viewing readonly version of main branch: v15
View latest version
README.md

GitHub/Gist File Server

This Val Town service fetches JavaScript or TypeScript files from GitHub repositories or Gists and serves them with the proper content type headers (application/javascript).

Usage

GitHub Repositories

To fetch a file from a GitHub repository:

/github/:owner/:repo/:branch/:path

Example:

/github/microsoft/TypeScript/main/lib/typescript.js

GitHub Gists

To fetch a file from a GitHub Gist:

/gist/:gistId/:filename

Example:

/gist/a1b2c3d4e5f6g7h8i9j0/example.js

Supported File Types

The service automatically sets the appropriate content type header based on the file extension:

  • .js, .mjs, .cjs: application/javascript
  • .ts, .tsx, .jsx: application/javascript (TypeScript files are served as JavaScript)
  • .json: application/json
  • Other file types: text/plain

Features

  • CORS enabled (Access-Control-Allow-Origin: *)
  • Caching (Cache-Control: public, max-age=3600)
  • Error handling for invalid URLs or unavailable files

Limitations

  • Only GET requests are supported
  • Files are served as-is without any transformation or transpilation
  • GitHub API rate limits may apply
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.