aboutsummaryrefslogtreecommitdiff
path: root/lib/office-xml-reader.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-04-27 22:41:20 +0100
committerMichael Williamson <mike@zwobble.org>2013-04-27 22:41:20 +0100
commit5610fd885e9255b9569b91b8fc73860d06d74ef4 (patch)
tree0685f31d5074cc616ae412bedb24599abdb76743 /lib/office-xml-reader.js
parent8a3d7bf7bd7c960a29afee293ef7b6a5011fe834 (diff)
Move readXmlFromZipFile into office-xml-reader
Diffstat (limited to 'lib/office-xml-reader.js')
-rw-r--r--lib/office-xml-reader.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/office-xml-reader.js b/lib/office-xml-reader.js
index 011ab4d..78d1299 100644
--- a/lib/office-xml-reader.js
+++ b/lib/office-xml-reader.js
@@ -1,7 +1,7 @@
var xmlreader = require("./xmlreader");
-exports.read = read;
+exports.readXmlFromZipFile = readXmlFromZipFile;
var xmlNamespaceMap = {
"http://schemas.openxmlformats.org/wordprocessingml/2006/main": "w",
@@ -15,3 +15,13 @@ var xmlNamespaceMap = {
function read(xmlString) {
return xmlreader.read(xmlString, xmlNamespaceMap);
}
+
+
+function readXmlFromZipFile(docxFile, path) {
+ if (docxFile.exists(path)) {
+ return docxFile.read(path, "utf-8")
+ .then(read);
+ } else {
+ return null;
+ }
+}