aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/content-types-reader.js10
-rw-r--r--lib/docx-reader.js9
2 files changed, 13 insertions, 6 deletions
diff --git a/lib/content-types-reader.js b/lib/content-types-reader.js
new file mode 100644
index 0000000..5240d21
--- /dev/null
+++ b/lib/content-types-reader.js
@@ -0,0 +1,10 @@
+exports.readContentTypesFromZipFile = readContentTypesFromZipFile;
+
+
+function readContentTypesFromZipFile(file) {
+ return {
+ findContentType: function(path) {
+ return "image/png";
+ }
+ }
+}
diff --git a/lib/docx-reader.js b/lib/docx-reader.js
index c96245a..0861758 100644
--- a/lib/docx-reader.js
+++ b/lib/docx-reader.js
@@ -9,6 +9,7 @@ var readXmlFromZipFile = require("./office-xml-reader").readXmlFromZipFile;
var documents = require("./documents");
var DocumentXmlReader = require("./document-xml-reader").DocumentXmlReader;
var readRelationshipsFromZipFile = require("./relationships-reader").readRelationshipsFromZipFile;
+var readContentTypesFromZipFile = require("./content-types-reader").readContentTypesFromZipFile;
var Result = require("./results").Result;
@@ -26,13 +27,9 @@ function read(options) {
return q.when(docxFile, function(docxFile) {
return q.all([
readRelationshipsFromZipFile(docxFile),
+ readContentTypesFromZipFile(docxFile),
readXmlFromZipFile(docxFile, "word/document.xml")
- ]).spread(function(relationships, documentXml) {
- var contentTypes = {
- findContentType: function(path) {
- return "image/png";
- }
- };
+ ]).spread(function(relationships, contentTypes, documentXml) {
var reader = new DocumentXmlReader(relationships, contentTypes, docxFile);
return reader.convertXmlToDocument(documentXml);
});