Skip to content

Instantly share code, notes, and snippets.

@chapel
Forked from Marak/imgur.coffee
Created April 4, 2011 07:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chapel/901241 to your computer and use it in GitHub Desktop.
Save chapel/901241 to your computer and use it in GitHub Desktop.
exports.exec = (options, callback) ->
# Load image
fs.readFile './image.jpg', (err, img) ->
if err
return callback(err, null);
# POST image to imgur
request {
method: 'POST',
body: "image=" + img.toString() + "&key=42e1c4982b52fabcae9033ff428d5175",
uri: 'http://imgur.com/api/upload.json',
}, (err, res, body) ->
if err
return callback err
callback(null, body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment