From c3f394bb9b6a91ccde7b2255e46db463afc63652 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 7 May 2015 21:27:34 +0000 Subject: Use edge.js to run mammoth.js from .NET --- Mammoth/mammoth.edge.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Mammoth/mammoth.edge.js (limited to 'Mammoth/mammoth.edge.js') 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 -- cgit v1.2.3