mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
15 lines
420 B
CoffeeScript
15 lines
420 B
CoffeeScript
|
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
|
||
|
}
|