Skip to content

Commit

Permalink
add missing doc (#37)
Browse files Browse the repository at this point in the history
* add missing doc

* fix package version

* 4.0.1
  • Loading branch information
heldr authored Aug 8, 2021
1 parent abb4028 commit a276ea5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
10 changes: 6 additions & 4 deletions docs/datauri-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
from: [Wikipedia](http://en.wikipedia.org/wiki/Data_URI_scheme)

[![Build Status](https://github.com/data-uri/datauri/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/data-uri/datauri/actions/workflows/main.yml?query=branch%3Amain)

## CLI
## CLI [![Build Status](https://github.com/data-uri/datauri/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/data-uri/datauri/actions/workflows/main.yml?query=branch%3Amain)

`npm install -g datauri-cli` (it may require Root privileges)

or

`npx datauri-cli <file_path> <flags>`

### Print

To print a data-uri scheme from a file
Expand Down Expand Up @@ -53,7 +55,7 @@ $ datauri brand.png --css --backgroundSize

## Requirements

Node.js 8+
Node.js 10+

## License

Expand Down
8 changes: 4 additions & 4 deletions docs/datauri.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ from: [Wikipedia](http://en.wikipedia.org/wiki/Data_URI_scheme)

## MODULE [![Build Status](https://github.com/data-uri/datauri/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/data-uri/datauri/actions/workflows/main.yml?query=branch%3Amain)

`npm install -S datauri`
`npm install datauri`

### Getting started

By default, datauri module returns a promise, which is resolved with `data:uri` string or rejected with file read error:
By default, datauri module returns a promise, which is resolved with `data:uri` string or rejected with read file error:

```js
const datauri = require('datauri');
Expand All @@ -43,6 +43,7 @@ datauri('test/myfile.png', (err, content, meta) => {

console.log(meta.mimetype); //=> "image/png"
console.log(meta.base64); //=> "iVBORw0KGgoAAAANSUhEUgAA..."
console.log(meta.buffer); //=> file buffer
});
```

Expand Down Expand Up @@ -71,8 +72,7 @@ const meta = Datauri('test/myfile.png');
console.log(meta.content); //=> "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
console.log(meta.mimetype); //=> "image/png"
console.log(meta.base64); //=> "iVBORw0KGgoAAAANSUhEUgAA..."
console.log(meta.getCSS()); //=> "\n.case {\n background-image: url('data:image/png;base64,iVBORw..."
console.log(meta.getCSS('myClass')); //=> "\n.myClass {\n background-image: url('data:image/png;base64,iVBORw..."
console.log(meta.buffer); //=> file buffer
```

### From a Buffer
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "datauri-build",
"private": true,
"version": "3.0.0",
"version": "4.0.1",
"scripts": {
"test": "npm run prettier:check && npm run lint && npm run build && npm run jest",
"jest": "jest",
Expand All @@ -13,7 +13,7 @@
"pkg-json": "mkdir -p lib/datauri && mkdir -p lib/datauri-cli && node tools/pkg-json.js",
"release": "npm run build && npm publish lib/datauri-cli && npm publish lib/datauri",
"preversion": "npm run test",
"postversion": "git commit --amend -a",
"postversion": "git commit --amend -a && npm run build",
"prettier:check": "prettier --check 'src/**/*.ts'",
"prettier:fix": "prettier --write 'src/**/*.ts'"
},
Expand Down
12 changes: 8 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,23 @@

[Module](http://npm.im/datauri) and [CLI](http://npm.im/datauri-cli) to generate [Data URI scheme](http://en.wikipedia.org/wiki/Data_URI_scheme).

[![Build Status](https://github.com/data-uri/datauri/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/data-uri/datauri/actions/workflows/main.yml?query=branch%3Amain) [![Dependency Status](https://www.versioneye.com/user/projects/560b7b3f5a262f001e0007e2/badge.svg?style=flat)](https://www.versioneye.com/user/projects/560b7b3f5a262f001e0007e2) [![NPM version](http://img.shields.io/npm/dm/datauri.svg?style=flat)](https://www.npmjs.org/package/datauri)
[![Build Status](https://github.com/data-uri/datauri/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/data-uri/datauri/actions/workflows/main.yml?query=branch%3Amain) [![NPM version](http://img.shields.io/npm/dm/datauri.svg?style=flat)](https://www.npmjs.org/package/datauri)

## Module

`npm i --save datauri`
`npm i datauri`

[See more in NPM page](http://npm.im/datauri)
[API Docs](http://npm.im/datauri)

## CLI

`npm i -g datauri-cli`

[See more in NPM page](http://npm.im/datauri-cli)
or

`npx datauri-cli <file_path> <flags>`

[CLI Docs](http://npm.im/datauri-cli)

## [ChangeLog](https://github.com/data-uri/datauri/releases)

Expand Down

0 comments on commit a276ea5

Please sign in to comment.