Skip to content

Commit

Permalink
Update deprecated Buffer usage
Browse files Browse the repository at this point in the history
  • Loading branch information
cmmcneill committed Jul 28, 2021
1 parent d03694a commit d213683
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/pdfimage.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let PDFImage = (function() {

this.btoa = function(val) {
if (typeof window === 'undefined') {
return (new Buffer(val, 'ascii')).toString('base64');
return (Buffer.from(val, 'ascii')).toString('base64');
}
else if (typeof window.btoa === 'function')
return window.btoa(val);
Expand Down
2 changes: 1 addition & 1 deletion pdfparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ let PDFParser = (function () {

//implements transform stream
PdfParser.prototype._transform = function (chunk, enc, callback) {
this.chunks.push(Buffer.isBuffer(chunk) ? chunk : new Buffer(chunk, enc));
this.chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, enc));
callback();
};

Expand Down

0 comments on commit d213683

Please sign in to comment.