Skip to content

A command line utility and library to generate a data URL, as specified by RFC 2397, from a local file path or remote URL.

License

Notifications You must be signed in to change notification settings

daetal-us/parlay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)
}

About

A command line utility and library to generate a data URL, as specified by RFC 2397, from a local file path or remote URL.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages