Skip to content

Commit 22271b0

Browse files
committed
Add the returned JSON (without the filename) as a third argument of the callback for toBuffer and toStream
1 parent 4c09ae7 commit 22271b0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/pdf.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ PDF.prototype.toBuffer = function PdfToBuffer (callback) {
4747
if (err) return callback(err)
4848
fs.unlink(res.filename, function unlinkPdfFile (err) {
4949
if (err) return callback(err)
50-
callback(null, buffer)
50+
delete res.filename
51+
callback(null, buffer, res)
5152
})
5253
})
5354
})
@@ -62,13 +63,15 @@ PDF.prototype.toStream = function PdfToStream (callback) {
6263
return callback(err)
6364
}
6465

66+
var filename = res.filename
6567
stream.on('end', function () {
66-
fs.unlink(res.filename, function (err) {
68+
fs.unlink(filename, function (err) {
6769
if (err) console.log('html-pdf:', err)
6870
})
6971
})
7072

71-
callback(null, stream)
73+
delete res.filename
74+
callback(null, stream, res)
7275
})
7376
}
7477

0 commit comments

Comments
 (0)