Skip to content

Latest commit

 

History

History
62 lines (44 loc) · 1.01 KB

README.md

File metadata and controls

62 lines (44 loc) · 1.01 KB

Parlay

A golang command line utility and library to generate 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)
}