diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-04-27 22:41:20 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-04-27 22:41:20 +0100 |
| commit | 5610fd885e9255b9569b91b8fc73860d06d74ef4 (patch) | |
| tree | 0685f31d5074cc616ae412bedb24599abdb76743 /lib/docx-reader.js | |
| parent | 8a3d7bf7bd7c960a29afee293ef7b6a5011fe834 (diff) | |
Move readXmlFromZipFile into office-xml-reader
Diffstat (limited to 'lib/docx-reader.js')
| -rw-r--r-- | lib/docx-reader.js | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/docx-reader.js b/lib/docx-reader.js index 02841a5..179bd08 100644 --- a/lib/docx-reader.js +++ b/lib/docx-reader.js @@ -5,7 +5,7 @@ var unzip = require("./unzip"); var path = require("path"); var fs = require("fs"); -var officeXmlReader = require("./office-xml-reader"); +var readXmlFromZipFile = require("./office-xml-reader").readXmlFromZipFile; var documents = require("./documents"); var DocumentXmlReader = require("./document-xml-reader").DocumentXmlReader; var Result = require("./results").Result; @@ -25,8 +25,8 @@ function read(options) { return q.when(docxFile, function(docxFile) { return q.all([ - readXmlFile(docxFile, "word/_rels/document.xml.rels"), - readXmlFile(docxFile, "word/document.xml") + readXmlFromZipFile(docxFile, "word/_rels/document.xml.rels"), + readXmlFromZipFile(docxFile, "word/document.xml") ]).spread(function(relationshipsXml, documentXml) { var relationships = relationshipsXml ? readRelationships(relationshipsXml) : {}; var contentTypes = { @@ -40,15 +40,6 @@ function read(options) { }); } -function readXmlFile(docxFile, path) { - if (docxFile.exists(path)) { - return docxFile.read(path, "utf-8") - .then(officeXmlReader.read); - } else { - return null; - } -} - function readRelationships(relationshipsXml) { var relationships = {}; relationshipsXml.root.children.forEach(function(child) { |
