Skip to content

Commit

Permalink
Update code samples in the README file. Fixes #135
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir Tocker committed Jan 9, 2019
1 parent 71316c6 commit 9882e58
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ request and it will be used instead of the normal https agent. e.g
```js

cloudinary.uploader.upload_stream(
function(result) { console.log(result); },
{ agent: myAgent }
{ agent: myAgent },
function(error, result) { console.log(result); }
);

```
Expand Down Expand Up @@ -105,9 +105,9 @@ Assuming you have your Cloudinary configuration parameters defined (`cloud_name`

The following example uploads a local JPG to the cloud:

var cloudinary = require('cloudinary')
var cloudinary = require('cloudinary').v2

cloudinary.uploader.upload("my_picture.jpg", function(result) { console.log(result) })
cloudinary.uploader.upload("my_picture.jpg", function(error, result) { console.log(result) })

Below is an example of an upload's result:

Expand All @@ -129,7 +129,7 @@ The uploaded image is assigned a randomly generated public ID. The image is imme

You can also specify your own public ID:

cloudinary.uploader.upload("http://www.example.com/image.jpg", function(result) { console.log(result) }, {public_id: 'sample_remote'})
cloudinary.uploader.upload("http://www.example.com/image.jpg", {public_id: 'sample_remote'}, function(error, result) { console.log(result) })

cloudinary.url("sample_remote.jpg")

Expand All @@ -142,7 +142,7 @@ You can also specify your own public ID:
You can use cloudinary.upload_stream to write to the uploader as a stream:

var fs = require('fs');
var stream = cloudinary.uploader.upload_stream(function(result) { console.log(result); });
var stream = cloudinary.uploader.upload_stream(function(error, result) { console.log(result); });
var file_reader = fs.createReadStream('my_picture.jpg', {encoding: 'binary'}).on('data', stream.write).on('end', stream.end);

#### Version 1.1 upload_stream change notes
Expand Down

0 comments on commit 9882e58

Please sign in to comment.