code: function(options, filename){	    
  	    Joi.assert(filename, Joi.string())
  	    return new Promise(function(resolve, reject){
  
  	        try{	            
  
  	            var writestream = fs.createWriteStream(filename);
  	            request(options).pipe(writestream);
  
  	            writestream.on('finish', function(err){                 
  	                if(err){
  	                    reject({
  	                        "path" : filename,
  	                        "status" : false,
  	                        "error": err
  	                    });
  	                }else{
  	                    resolve({
  	                        "path" : filename,
  	                        "status" : true
  	                    });
  	                }
  	            });
  
  	        }catch(e){
  	            reject(e);
  	        }
  	    });
  	}
docs: /*
  Download and save attachment from DB