diff options
Diffstat (limited to 'lib/docx/style-map.js')
| -rw-r--r-- | lib/docx/style-map.js | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/lib/docx/style-map.js b/lib/docx/style-map.js index dcc9f66..5020a87 100644 --- a/lib/docx/style-map.js +++ b/lib/docx/style-map.js @@ -1,5 +1,4 @@ var promises = require("../promises"); -var unzip = require("../unzip"); exports.writeStyleMap = writeStyleMap; exports.readStyleMap = readStyleMap; @@ -7,25 +6,14 @@ exports.readStyleMap = readStyleMap; var styleMapPath = "mammoth/style-map"; -function writeStyleMap(options) { - return promises.when(unzip.openZip(options)) - .then(function(zipFile) { - - zipFile.write(styleMapPath, options.styleMap); - - return { - toBuffer: zipFile.toBuffer - }; - }); +function writeStyleMap(docxFile, styleMap) { + docxFile.write(styleMapPath, styleMap); } -function readStyleMap(options) { - return promises.when(unzip.openZip(options)) - .then(function(zipFile) { - if (zipFile.exists(styleMapPath)) { - return zipFile.read(styleMapPath, "utf8"); - } else { - return promises.when(null); - } - }); +function readStyleMap(docxFile) { + if (docxFile.exists(styleMapPath)) { + return docxFile.read(styleMapPath, "utf8"); + } else { + return promises.resolve(null); + } } |
