client

package
v0.0.0-...-d09d7ef Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package client implements communication with the asciist service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	URL  string
	HTTP *http.Client
}

A Client provides convenient interaction with the asciist service.

func New

func New(url string) *Client

New creates a new Client for a service rooted at the given url. It uses the default net/http Client to talk to the service.

func NewWithHTTP

func NewWithHTTP(url string, httpClient *http.Client) *Client

NewWithHTTP creates a new Client for a service rooted at the given url, using the given http Client for communication.

func (*Client) Convert

func (c *Client) Convert(reader io.Reader, width uint) (string, error)

Convert asks the service to create ASCII art based on the image whose contents can be read out of the given reader. The art returned will be `width` characters wide, with a height chosen by the service to match the input image's aspect ratio when drawn with typical monospace fonts at a typical line height.

func (*Client) ConvertBytes

func (c *Client) ConvertBytes(image []byte, width uint) (string, error)

ConvertBytes asks the service to create ASCII art based on the image whose contents are contained in the given byte slice. The art returned will be `width` characters wide, with a height chosen by the service to match the input image's aspect ratio when drawn with typical monospace fonts at a typical line height.

func (*Client) ConvertFile

func (c *Client) ConvertFile(filename string, width uint) (string, error)

ConvertFile asks the service to create ASCII art based on the image with the given filename. The art returned will be `width` characters wide, with a height chosen by the service to match the input image's aspect ratio when drawn with typical monospace fonts at a typical line height.

Jump to

Keyboard shortcuts

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