diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-03-30 15:33:51 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-03-30 15:33:51 +0000 |
| commit | 2bae91155de4c8af88db552f26105b9d09fd972e (patch) | |
| tree | ec4065376486b1389672156b59cea5c480c94e49 | |
| parent | 461ae787be5a4fce406c07498cc176c99c9615a2 (diff) | |
Add main.js
| -rw-r--r-- | lib/main.js | 26 | ||||
| -rw-r--r-- | package.json | 4 |
2 files changed, 29 insertions, 1 deletions
diff --git a/lib/main.js b/lib/main.js new file mode 100644 index 0000000..771c382 --- /dev/null +++ b/lib/main.js @@ -0,0 +1,26 @@ +var optimist = require("optimist"); +var ZipFile = require("zipfile").ZipFile; +var q = require("q"); + +var mammoth = require("./"); + + +var argv = optimist.argv; +var zipFile = new ZipFile(argv._[0]); +var docxFile = { + read: function(path) { + return q.ninvoke(zipFile, "readFile", path, "utf-8") + .then(function(value) { + return value.toString(); + }); + } +}; + + +var converter = new mammoth.Converter(); +converter.convertToHtml(docxFile) + .then(function(result) { + console.log(result); + }) + .done(); + diff --git a/package.json b/package.json index ce9978d..0d7da11 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,9 @@ "q": "~0.9.2", "sax": "~0.5.2", "underscore": "~1.4.4", - "lop": "~0.2.6" + "lop": "~0.2.6", + "zipfile": "~0.3.4", + "optimist": "~0.3.5" }, "devDependencies": { "mocha": "~1.8" |
