react-pdf
react-pdf copied to clipboard
DeprecationWarning: Buffer() is deprecated due to security and usability issues
I'm getting the below deprecation warning when using the latest version of react-pdf.
DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
at showFlaggedDeprecation (buffer.js:198:11)
at new Buffer (buffer.js:282:3)
at DecodeStream.readString (webpack:///../node_modules/restructure/src/DecodeStream.js?:58:17)
at StringT.decode (webpack:///../node_modules/restructure/src/String.js?:32:23)
at eval (webpack:///../node_modules/restructure/src/Pointer.js?:69:30)
at Pointer.decode (webpack:///../node_modules/restructure/src/Pointer.js?:79:16)
at Struct._parseFields (webpack:///../node_modules/restructure/src/Struct.js?:53:22)
at Struct.decode (webpack:///../node_modules/restructure/src/Struct.js?:18:12)
at ArrayT.decode (webpack:///../node_modules/restructure/src/Array.js?:49:30)
at VersionedStruct.Struct._parseFields (webpack:///../node_modules/restructure/src/Struct.js?:53:22)
It looks like the warning is coming from [email protected]
which is a dependency of @react-pdf/fontkit
. Upgrading to the latest version of restructure
will be enough to get rid of the warning.