Skip to content

Latest commit

 

History

History
54 lines (41 loc) · 1.37 KB

README.md

File metadata and controls

54 lines (41 loc) · 1.37 KB

fetch -- Fetch Data from URL

check vulns lint status GitHub license GitHub release

This package is required Go 1.16 or later.

Migrated repository to github.com/goark/fetch

Import

import "github.com/goark/fetch"

Usage

package main

import (
    "context"
    "fmt"
    "io"
    "os"

    "github.com/goark/fetch"
)

func main() {
    u, err := fetch.URL("https://github.com/spiegel-im-spiegel.gpg")
    if err != nil {
        fmt.Fprintln(os.Stderr, err)
        return
    }
    resp, err := fetch.New().GetWithContext(context.Background(), u)
    if err != nil {
        fmt.Fprintln(os.Stderr, err)
        return
    }
    defer resp.Close()
    if _, err := io.Copy(os.Stdout, resp.Body()); err != nil {
        fmt.Fprintln(os.Stderr, err)
    }
}

Modules Requirement Graph

dependency.png