aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-04-11 20:12:04 +0100
committerMichael Williamson <mike@zwobble.org>2013-04-11 20:12:04 +0100
commitc57b900666a82b4ccce033a923e53906255078c0 (patch)
treec8619bf48c3bca17ea3c429194b96c0b3937e16b /lib
parent57622e1584e7367aa41d4a09f8db33c703a6a0df (diff)
Don't guess what the input for conversion is
Diffstat (limited to 'lib')
-rw-r--r--lib/docx-reader.js11
-rw-r--r--lib/index.js4
2 files changed, 10 insertions, 5 deletions
diff --git a/lib/docx-reader.js b/lib/docx-reader.js
index fcc69fe..832ff31 100644
--- a/lib/docx-reader.js
+++ b/lib/docx-reader.js
@@ -15,10 +15,15 @@ var DocumentXmlReader = require("./document-xml-reader").DocumentXmlReader;
var Result = require("./results").Result;
-function read(docxFile) {
- if (_.isString(docxFile)) {
+function read(options) {
+ var docxFile;
+ if (options.path) {
var zipPath = docxFile;
- docxFile = openZip(zipPath);
+ docxFile = openZip(options.path);
+ } else if (options.file) {
+ docxFile = options.file;
+ } else {
+ return q.reject(new Error("Could not find file in options"));
}
return q.when(docxFile, function(docxFile) {
diff --git a/lib/index.js b/lib/index.js
index 778aad6..fb734e6 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -16,9 +16,9 @@ function Converter(options) {
this._documentConverter = new DocumentConverter(options);
}
-Converter.prototype.convertToHtml = function(docxFile) {
+Converter.prototype.convertToHtml = function(inputOptions) {
var documentConverter = this._documentConverter;
- return docxReader.read(docxFile)
+ return docxReader.read(inputOptions)
.then(function(documentResult) {
return documentResult.mapThen(function(document) {
return documentConverter.convertToHtml(document);