Skip to content
Browse files

misc formatting cleanups

  • Loading branch information...
1 parent b90d7e5 commit 7dc90177e27be5c9dae8bf9ed842840144a5e1ae @atmos atmos committed Aug 26, 2011
Showing with 7 additions and 7 deletions.
  1. +7 −7 index.js
View
14 index.js
@@ -1,5 +1,5 @@
http = require('http')
-https = require('https')
+https = require('https')
fs = require('fs')
url = require('url')
@@ -11,7 +11,7 @@ function fetch(query,cb){
var google = 'http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=8&q=' + encodeURI(query)
req({uri:google}, function (e, resp, body) {
result = JSON.parse(body)['responseData']['results'][0]
-
+
if(result)
cb(result['unescapedUrl'])
else
@@ -21,15 +21,15 @@ function fetch(query,cb){
function download(match, output, addText){
fetch(match, function(file){
- var uri = url.parse(file)
- var host = uri.hostname
+ var uri = url.parse(file)
+ , host = uri.hostname
, path = uri.pathname
-
+
if(uri.protocol == "https:")
var r = https
- else
+ else
var r = http
-
+
request = r.get({host: host, path: path}, function(res){
res.setEncoding('binary')
var img = ''

0 comments on commit 7dc9017

Please sign in to comment.
Something went wrong with that request. Please try again.