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 /lib/main.js | |
| parent | 461ae787be5a4fce406c07498cc176c99c9615a2 (diff) | |
Add main.js
Diffstat (limited to 'lib/main.js')
| -rw-r--r-- | lib/main.js | 26 |
1 files changed, 26 insertions, 0 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(); + |
