www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 2b4de89aaf13329ef4c7eb78c7328b91ca745cec
parent 43978624de35301189b0506c201c24ce966ee96f
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sun, 11 Aug 2013 20:49:18 -0400

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

Diffstat:
Mchrome/content/zotero/xpcom/file.js | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/chrome/content/zotero/xpcom/file.js b/chrome/content/zotero/xpcom/file.js @@ -217,6 +217,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 */ function putContents(file, str) {