overleaf/services/web/app/coffee/Features/LinkedFiles/UrlAgent.coffee

15 lines
420 B
CoffeeScript
Raw Normal View History

2018-02-14 10:12:46 -05:00
request = require 'request'
FileWriter = require('../../infrastructure/FileWriter')
module.exports = UrlAgent = {
sanitizeData: (data) ->
return {
url: data.url
}
writeIncomingFileToDisk: (project_id, data, current_user_id, callback = (error, fsPath) ->) ->
# TODO: proxy through external API
url = data.url
readStream = request.get(url)
FileWriter.writeStreamToDisk project_id, readStream, callback
}