File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -40,18 +40,19 @@ argument can be a `Buffer` or a `String`. Strings are converted to buffers
40
40
using ` utf-8 ` encoding.
41
41
42
42
If ` mediatype ` is not specified, then ` application/octet-stream ` is used
43
- as a default.
43
+ as a default if the data is a Buffer, and ` text/plain;charset=UTF-8 ` if
44
+ the data is a String.
44
45
45
46
``` js
46
47
var dataUri = require (' strong-data-uri' );
47
48
48
49
uri = dataUri .encode (' foo' );
49
50
console .log (uri);
50
- // data:application/octet-stream ;base64,Zm9v
51
+ // data:text/plain;charset=UTF-8 ;base64,Zm9v
51
52
52
- uri = dataUri .encode (new Buffer (' foo' , ' utf8' ), ' text/plain ' );
53
+ uri = dataUri .encode (new Buffer (' < foo/> ' , ' utf8' ), ' text/xml ' );
53
54
console .log (uri);
54
- // data:text/plain ;base64,Zm9v
55
+ // data:text/xml ;base64,PGZvby8+
55
56
```
56
57
57
58
## Command-line access
You can’t perform that action at this time.
0 commit comments