Skip to content

Commit

Permalink
Merge pull request riyadhalnur#6 from revolunet/patch-1
Browse files Browse the repository at this point in the history
README fixes
  • Loading branch information
riyadhalnur committed Nov 5, 2015
2 parents 98dac6e + 2212376 commit b2fea30
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ var options = {string: true};
base64.base64encoder('www.someurl.com/image.jpg', options, function (err, image) {
if (err) {
console.log(err);
}
console.log(err);
}
console.log(image);
});
```
Expand All @@ -33,18 +33,19 @@ base64.base64encoder('www.someurl.com/image.jpg', options, function (err, image)
var path = __dirname + '/../test.jpg',
options = {localFile: true, string: true};
base64.base64encode(path, function (err, image) {
base64.base64encoder(path, options, function (err, image) {
if (err) { console.log(err); }
console.log(image);
});
```


##### Parameters
url (string) - the url of the image to be downloaded and encoded.
options (object) - if string is passed is with 'true', the image returned will be a base64 string. Otherwise, the base64 buffer is returned.
if localFile is passed is with 'true', a local image instead of a remote one will be used
callback (function) - the callback will contain the err object and the encoded image object.
- `url` (string) - the url of the image to be downloaded and encoded.
- `options` (object)
- if `string` is passed is with 'true', the image returned will be a base64 string. Otherwise, the base64 buffer is returned.
- if `localFile` is passed is with 'true', a local image instead of a remote one will be used
- `callback` (function) - the callback will contain the err object and the encoded image object.

#### Decode and write a base64 encoded image to disk
```
Expand All @@ -58,9 +59,9 @@ base64.base64decoder(imageData, options, function (err, saved) {
```

##### Parameters
imageData (buffer) - the base64 image buffer.
options (object) - contains the 'filename' property; this will be the written image file.
callback (function) - the callback will contain the err object and the 'successful save' string.
- `imageData` (buffer) - the base64 image buffer.
- `options` (object) - contains the 'filename' property; this will be the written image file.
- `callback` (function) - the callback will contain the err object and the 'successful save' string.

### License
This library is licensed under the MIT license.
Expand Down

0 comments on commit b2fea30

Please sign in to comment.