grab

command module
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2026 License: BSD-3-Clause Imports: 1 Imported by: 0

README

grab

Nightly Tests Pre-main Tests Go Version License

A minimal Go CLI and library for downloading files from the internet, inspired by cURL and wget.

Features

  • Download files from URLs to your local directory
  • Automatic filename detection from Content-Disposition headers or URL paths
  • Download multiple files concurrently
  • Real-time progress tracking with verbose mode
  • Built-in file hash computation (MD5, SHA1, SHA256)
  • Simple, modern CLI with grab download [url]...
  • Usable as a Go library or standalone binary

Install

Download the latest release for your platform from the Releases page:

Linux (x86_64):

curl -L https://github.com/sebrandon1/grab/releases/latest/download/grab-linux-amd64 -o grab
chmod +x grab

macOS (Intel):

curl -L https://github.com/sebrandon1/grab/releases/latest/download/grab-darwin-amd64 -o grab
chmod +x grab

macOS (Apple Silicon):

curl -L https://github.com/sebrandon1/grab/releases/latest/download/grab-darwin-arm64 -o grab
chmod +x grab

Windows:

curl -L https://github.com/sebrandon1/grab/releases/latest/download/grab-windows-amd64.exe -o grab.exe
Option 2: Build from Source

Requirements: Go 1.24 or newer

git clone https://github.com/sebrandon1/grab.git
cd grab
make build

This will produce a grab binary in the repo root.

Usage

CLI

Download a single file:

grab download https://github.com/sebrandon1/grab/archive/refs/heads/main.zip

Download multiple files concurrently:

grab download https://go.dev/dl/go1.21.5.src.tar.gz https://go.dev/dl/go1.21.4.src.tar.gz

Download with verbose progress output:

grab download https://go.dev/dl/go1.21.5.darwin-amd64.tar.gz --verbose

Example output:

Downloading: [======================================= ]  99.34% (135728945/136421772 bytes)
Downloaded: go1.21.5.darwin-amd64.tar.gz (size: 136421772 bytes)

Download from GitHub releases:

grab download https://github.com/golang/go/archive/refs/tags/go1.21.5.tar.gz

Compute file hashes:

# Download and verify file integrity
grab download https://github.com/sebrandon1/grab/archive/refs/heads/main.zip
grab hash main.zip --type sha256

# Different hash algorithms
grab hash myfile.tar.gz --type md5
grab hash myfile.tar.gz --type sha1

Get help:

grab --help
grab download --help
grab hash --help
As a Go Library

See lib/README.md for full documentation of the public API.

package main

import (
	"log"
	"github.com/sebrandon1/grab/lib"
	"context"
)

func main() {
	urls := []string{
		"https://github.com/sebrandon1/grab/archive/refs/heads/main.zip",
		"https://go.dev/dl/go1.21.5.src.tar.gz",
	}
	ch, err := lib.DownloadBatch(context.Background(), urls)
	if err != nil {
		log.Fatal(err)
	}
	for resp := range ch {
		if resp.Err != nil {
			log.Printf("Failed: %s (%v)", resp.Filename, resp.Err)
		} else {
			log.Printf("Downloaded: %s", resp.Filename)
		}
	}
}

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
package lib provides a HTTP download manager implementation.
package lib provides a HTTP download manager implementation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL