parlay

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2018 License: MIT Imports: 8 Imported by: 0

README

Parlay

A golang command line utility and library to generates a data URL, as specified by RFC 2397, from a binary string, file path or remote URL.

Installation

go get github.com/daetal-us/parlay/cmd/parlay

Usage

Command Line

Convert an local image to a data url and pipe to clipboard:

parlay path/to/my/photo.png

Convert a remote resource to a data url:

parlay https://secure.gravatar.com/avatar/245101069f239ec4a678f7eafd022045?s=1
Golang
package main

import (
	"log"

	"github.com/daetal-us/parlay"
)

func main() {
	getDataURLFromPath()
	getDataURLFromURL()
}

func getDataURLFromPath() {
	url, err := parlay.FromPath("parlay_test.bmp")
	if err != nil {
		log.Fatal(err)
	}
	log.Println(url)
}

func getDataURLFromURL() {
	url, err := parlay.FromURL("https://secure.gravatar.com/avatar/245101069f239ec4a678f7eafd022045?s=1")
	if err != nil {
		log.Fatal(err)
	}
	log.Println(url)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromBytes

func FromBytes(data []byte, mimeType string) string

func FromPath

func FromPath(path string) (string, error)

func FromURL

func FromURL(u string) (string, error)

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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