Add Zotero.File.getContentsFromURLAsync(url) for local text files

This commit is contained in:
Dan Stillman 2013-08-11 20:49:18 -04:00
parent 43978624de
commit 2b4de89aaf

View file

@ -216,6 +216,17 @@ Zotero.File = new function(){
}
/*
* Return a promise for the contents of a URL as a string
*/
this.getContentsFromURLAsync = function (url) {
return Zotero.HTTP.promise("GET", url, { responseType: "text" })
.then(function (xmlhttp) {
return xmlhttp.response;
});
}
/*
* Write string to a file, overwriting existing file if necessary
*/