                             @makeRequest "#{name}.#{functionName}",[params],callback
                     else
                         @makeRequest "#{name}.#{functionName}",[],params
+
+    download : (url,path,callback)->
+        request = http.get url,(response)=>
+            if response.statusCode is 200
+                fstream = Fs.createWriteStream(path)
+                response.pipe(fstream)
+                if @maxTimeout
+                    request.setTimeout @maxTimeout,=>
+                        request.abort()
+                        callback("request timeout")
+
+                fstream.on "error",=>
+                    Fs.unlink(path)
+                    fstream.close(callback)
+
+                fstream.on "finish",=>
+                    fstream.close(callback)
+            else
+                request.abort()
+                callback("request error : #{response.statusCode}")
+        request.on "error",(err)=>
+            callback(err)
 
 
     benchRequest : (path,params,benchcallback)->


class OTHERWebInstance
    constructor : (@userAgent,@rootURL,@username,@password)->
        @loginStatus = "incomplete"
        @requestQueue=[]
        @client = new jsonrpc("#{@rootURL}/gateway/api/jsonrpc.jsp")
        @keepaliveTimeout=null
        @data = {}

    compileObject : (name,functions)->
        callinstance = @[name]={}

jsonrpc = require './jsonrpc.coffee'
{EventEmitter} = require 'events'
Fs = require 'fs'
http = require 'http'

class TimelineEvent extends EventEmitter
    constructor : (@otherweb)->
