Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/abiriadev/dataurl

convert given file to data URL
https://github.com/abiriadev/dataurl

data-url dataurl

Last synced: 25 days ago
JSON representation

convert given file to data URL

Awesome Lists containing this project

README

        

dataurl


convert given file to data URL

# Installation

```sh
$ go install github.com/abiriadev/dataurl@latest
```

# Usage

## Encode

```sh
$ dataurl ./image.png
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5C
```

## Specify MIME types

```sh
$ dataurl ./post.md
data:text/markdown; charset=utf-8;base64,IyBIZWxsbywgd29ybGQh

$ dataurl --mime 'text/plain; charset=UTF-8' ./post.md
data:text/plain; charset=UTF-8;base64,IyBIZWxsbywgd29ybGQh
```

## Read from standard input

```sh
$ dataurl < ./post.md
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5C

$ dataurl --mime 'text/plain; charset=UTF-8' ./post.md
data:text/plain; charset=UTF-8;base64,IyBIZWxsbywgd29ybGQh
```

# License

[![Licence](https://img.shields.io/github/license/abiriadev/dataurl?style=for-the-badge)](./LICENSE)