catbox

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2021 License: MIT Imports: 11 Imported by: 2

README

go-catbox

go-catbox is a toolkit to help upload files to Catbox.

Installation

The simplest, cross-platform way is to download from GitHub Releases and place the executable file in your PATH.

Via Golang package get command

go get -u github.com/wabarc/go-catbox/cmd/catbox

From gobinaries.com:

$ curl -sf https://gobinaries.com/wabarc/go-catbox | sh

Usage

Command-line:

$ catbox
A CLI tool help upload files to Catbox.

Usage:

  catbox [options] [file1] ... [fileN]

Go package:

import (
        "fmt"

        "github.com/wabarc/go-catbox"
)

func main() {
        if url, err := catbox.New(nil).Upload(path); err != nil {
            fmt.Fprintf(os.Stderr, "catbox: %v\n", err)
        } else {
            fmt.Fprintf(os.Stdout, "%s  %s\n", url, path)
        }
}

License

This software is released under the terms of the MIT. See the LICENSE file for details.

Documentation

Index

Constants

View Source
const (
	ENDPOINT = "https://catbox.moe/user/api.php"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Catbox

type Catbox struct {
	Client   *http.Client
	Userhash string
}

func New

func New(client *http.Client) *Catbox

func (*Catbox) Delete

func (cat *Catbox) Delete(files ...string) error

func (*Catbox) Upload

func (cat *Catbox) Upload(path string) (string, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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