Skip to content

Commit 093aedc

Browse files
committed
docs: Rebuilt readme with tldw
1 parent 72f6046 commit 093aedc

File tree

1 file changed

+90
-2
lines changed

1 file changed

+90
-2
lines changed

readme.md

Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,91 @@
11
# buffer-to-data-url
2-
## Under construction
3-
Not much to see right now. Come back lator! :crocodile:
2+
3+
4+
<a href="https://raw.githubusercontent.com/jaid/buffer-to-data-url/master/license.txt"><img src="https://img.shields.io/github/license/jaid/buffer-to-data-url?style=flat-square" alt="License"/></a> <a href="https://github.com/sponsors/jaid"><img src="https://img.shields.io/badge/<3-Sponsor-FF45F1?style=flat-square" alt="Sponsor buffer-to-data-url"/></a>
5+
<a href="https://actions-badge.atrox.dev/jaid/buffer-to-data-url/goto"><img src="https://img.shields.io/endpoint.svg?style=flat-square&url=https%3A%2F%2Factions-badge.atrox.dev%2Fjaid%2Fbuffer-to-data-url%2Fbadge" alt="Build status"/></a> <a href="https://github.com/jaid/buffer-to-data-url/commits"><img src="https://img.shields.io/github/commits-since/jaid/buffer-to-data-url/v0.1.0?style=flat-square&logo=github" alt="Commits since v0.1.0"/></a> <a href="https://github.com/jaid/buffer-to-data-url/commits"><img src="https://img.shields.io/github/last-commit/jaid/buffer-to-data-url?style=flat-square&logo=github" alt="Last commit"/></a> <a href="https://github.com/jaid/buffer-to-data-url/issues"><img src="https://img.shields.io/github/issues/jaid/buffer-to-data-url?style=flat-square&logo=github" alt="Issues"/></a>
6+
<a href="https://npmjs.com/package/buffer-to-data-url"><img src="https://img.shields.io/npm/v/buffer-to-data-url?style=flat-square&logo=npm&label=latest%20version" alt="Latest version on npm"/></a> <a href="https://github.com/jaid/buffer-to-data-url/network/dependents"><img src="https://img.shields.io/librariesio/dependents/npm/buffer-to-data-url?style=flat-square&logo=npm" alt="Dependents"/></a> <a href="https://npmjs.com/package/buffer-to-data-url"><img src="https://img.shields.io/npm/dm/buffer-to-data-url?style=flat-square&logo=npm" alt="Downloads"/></a>
7+
8+
**Creates a base64-encoded data URL from a Buffer and a mimetype.**
9+
10+
11+
12+
13+
14+
## Installation
15+
16+
<a href="https://npmjs.com/package/buffer-to-data-url"><img src="https://img.shields.io/badge/npm-buffer--to--data--url-C23039?style=flat-square&logo=npm" alt="buffer-to-data-url on npm"/></a>
17+
18+
```bash
19+
npm install --save buffer-to-data-url@^0.1.0
20+
```
21+
22+
<a href="https://yarnpkg.com/package/buffer-to-data-url"><img src="https://img.shields.io/badge/Yarn-buffer--to--data--url-2F8CB7?style=flat-square&logo=yarn&logoColor=white" alt="buffer-to-data-url on Yarn"/></a>
23+
24+
```bash
25+
yarn add buffer-to-data-url@^0.1.0
26+
```
27+
28+
<a href="https://github.com/jaid/buffer-to-data-url/packages"><img src="https://img.shields.io/badge/GitHub Packages-@jaid/buffer--to--data--url-24282e?style=flat-square&logo=github" alt="@jaid/buffer-to-data-url on GitHub Packages"/></a>
29+
(if [configured properly](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-npm-for-use-with-github-packages))
30+
31+
```bash
32+
npm install --save @jaid/buffer-to-data-url@^0.1.0
33+
```
34+
35+
36+
37+
## Example
38+
39+
40+
```javascript
41+
import bufferToDataUrl from "buffer-to-data-url"
42+
43+
const imageBuffer = fs.readFileSync("pikachu_8x8.png")
44+
const dataUrl = bufferToDataUrl("image/png", imageBuffer)
45+
```
46+
47+
Variable `result` will be:
48+
49+
```javascript
50+
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAARklEQVQoU2P8/Z/hPwMewEiUAhaG/wyMjIwMv6FmIfPBJrAyQuyAKUDmo1iBrhCkifG/oBrY4D/vbqE4lUVIDcwnrICQLwAWoihJ/lJMVwAAAABJRU5ErkJgggAA"
51+
```
52+
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
65+
66+
67+
68+
69+
## Development
70+
71+
72+
73+
Setting up:
74+
```bash
75+
git clone git@github.com:jaid/buffer-to-data-url.git
76+
cd buffer-to-data-url
77+
npm install
78+
```
79+
Testing:
80+
```bash
81+
npm run test:dev
82+
```
83+
Testing in production environment:
84+
```bash
85+
npm run test
86+
```
87+
88+
89+
## License
90+
[MIT License](https://raw.githubusercontent.com/jaid/buffer-to-data-url/master/license.txt)
91+
Copyright © 2020, Jaid \<jaid.jsx@gmail.com> (https://github.com/jaid)

0 commit comments

Comments
 (0)