aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/browser.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/browser.js b/lib/browser.js
index bd34c13..4f3b71b 100644
--- a/lib/browser.js
+++ b/lib/browser.js
@@ -8,6 +8,7 @@ exports.standardOptions = mammoth.standardOptions;
exports.htmlPaths = mammoth.htmlPaths;
exports.convertDocumentToHtml = callbackify(mammoth.convertDocumentToHtml);
+exports.convertArrayBufferToHtml = convertArrayBufferToHtml;
function callbackify(func) {
return function() {
@@ -17,6 +18,19 @@ function callbackify(func) {
};
}
+function convertArrayBufferToHtml(arrayBuffer, options, callback) {
+ try {
+ var file = openFile(arrayBuffer);
+ var result = mammoth.read({file: file}).then(function(documentResult) {
+ var options = mammoth.standardOptions;
+ return mammoth.convertDocumentToHtml(documentResult, options);
+ });
+ satisfyCallback(result, callback);
+ } catch (error) {
+ callback({error: error});
+ }
+}
+
function readFileInputOnChange(inputElement, callback) {
function handleFileSelect(event) {
var file = event.target.files[0];