diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-05-07 21:27:34 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-05-07 21:27:34 +0000 |
| commit | c3f394bb9b6a91ccde7b2255e46db463afc63652 (patch) | |
| tree | e3e5d670be450ed774f0fb0ca587a3bde53fa4b8 /Mammoth/mammoth.edge.js | |
Use edge.js to run mammoth.js from .NET
Diffstat (limited to 'Mammoth/mammoth.edge.js')
| -rw-r--r-- | Mammoth/mammoth.edge.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Mammoth/mammoth.edge.js b/Mammoth/mammoth.edge.js new file mode 100644 index 0000000..a5a96a9 --- /dev/null +++ b/Mammoth/mammoth.edge.js @@ -0,0 +1,18 @@ +; +return function(data, callback) { + var mammoth = module.exports; + + mammoth.convertToHtml({arrayBuffer: toArrayBuffer(data)}) + .then(function(result) { + callback(null, result.value); + }, callback); + + function toArrayBuffer(buffer) { + var ab = new ArrayBuffer(buffer.length); + var view = new Uint8Array(ab); + for (var i = 0; i < buffer.length; ++i) { + view[i] = buffer[i]; + } + return ab; + } +};
\ No newline at end of file |
