diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-04-27 22:48:31 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-04-27 22:48:31 +0100 |
| commit | e1f18ccd40a40c8f9001517c9f6aa56a797a9110 (patch) | |
| tree | 4f98ccf6d490a98000564c0b6185600c09b3101d | |
| parent | 6b040ed3f347e34fc89013ff7dc9268c733cee47 (diff) | |
Split out stubbed implementation of content-types-reader
| -rw-r--r-- | lib/content-types-reader.js | 10 | ||||
| -rw-r--r-- | lib/docx-reader.js | 9 |
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); }); |
