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.
go get github.com/daetal-us/parlay/cmd/parlay
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
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)
}