Skip to content

Commit 2631428

Browse files
committed
only allow quality
1 parent 7ff5f13 commit 2631428

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/canvas.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,14 @@ Canvas.prototype.convertToBlob = async function (options = {}) {
5858
? options.type
5959
: 'image/png'
6060

61+
const quality = options.quality != null
62+
? { quality: options.quality }
63+
: undefined
64+
6165
return new Promise((resolve, reject) => {
6266
this.toBuffer((err, buf) => {
6367
err ? reject(err) : resolve(new Blob([buf], { type }))
64-
}, type, options)
68+
}, type, quality)
6569
})
6670
}
6771

@@ -133,4 +137,4 @@ Canvas.prototype.toDataURL = function (a1, a2, a3) {
133137
}
134138
}
135139

136-
module.exports = Canvas
140+
module.exports = Canvas

0 commit comments

Comments
 (0)