diff --git a/lib/common/writefile.js b/lib/common/writefile.js index bb3ea42e..de08e59e 100644 --- a/lib/common/writefile.js +++ b/lib/common/writefile.js @@ -4,12 +4,16 @@ */ const fs = require('fs'); +const Buffer = require('buffer').Buffer; -module.exports = async function (filename, content) { +module.exports = async function(filename, content) { return new Promise((resolve, reject) => { - fs.writeFile(filename, String(content), err => { + if (typeof content !== 'string' && !Buffer.isBuffer(content)) { + content = String(content); + } + fs.writeFile(filename, content, (err) => { if (err) return reject(err); resolve(filename); }); }); -}; \ No newline at end of file +}; diff --git a/package-lock.json b/package-lock.json index 1869ada1..bbddb7c3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "dawn", - "version": "1.9.1", + "version": "1.9.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4f157d1a..bb439367 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dawn", - "version": "1.9.1", + "version": "1.9.3", "description": "dawn cli", "main": "./lib/index.js", "bin": {