https://github.com/block/getit
A Go library for fetching remote archives using a clean consistent URI scheme
https://github.com/block/getit
Last synced: 19 days ago
JSON representation
A Go library for fetching remote archives using a clean consistent URI scheme
- Host: GitHub
- URL: https://github.com/block/getit
- Owner: block
- License: apache-2.0
- Created: 2026-02-03T10:14:00.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2026-03-24T05:27:58.000Z (4 months ago)
- Last Synced: 2026-06-10T10:28:02.542Z (about 1 month ago)
- Language: Go
- Size: 35.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
- Governance: GOVERNANCE.md
Awesome Lists containing this project
README
# A Go library for fetching and unpacking archives from multiple sources.
This is a bit like hashicorp/go-getter, but much simpler, and with less supported protocols (so far).
## Features
- **Git repositories**: Clone from git://, git+ssh://, or git+https:// URLs with optional ref and depth parameters
- **TAR archives**: Fetch and extract .tar, .tar.gz, .tar.bz2, .tar.xz, and other compressed tarballs
- **ZIP archives**: Download and unzip .zip files
- **GitHub shortcuts**: Map shorthand URLs like `user/repo` or `github.com/user/repo` to full git URLs
- **Subdirectory support**: Extract specific subdirectories using `//` delimiter (e.g., `https://example.com/archive.tar.gz//subdir`)
## Usage
```go
import "github.com/block/getit"
// Create a fetcher with resolvers and mappers
fetcher := getit.New(
[]getit.Resolver{
getit.NewGit(),
getit.NewTAR(),
getit.NewZIP(),
},
[]getit.Mapper{
getit.GitHub,
getit.GitHubOrgRepo,
getit.SingleGitHubOrg("myorg"),
},
)
// Fetch an archive
err := fetcher.Fetch(ctx, "user/repo?ref=main&depth=1", "./destination")
```