forked from tjanczuk/iisnode
-
Notifications
You must be signed in to change notification settings - Fork 99
Open
Description
Hi Y'all! Thanks so much for this essential software!
Running this code on a Windows web server, supporting a node.js application, my node log file records the following warning:
(node:12064) [DEP0005] 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:192:11)
at new Buffer (buffer.js:279:3)
at ensureBuffer (C:\Program Files (x86)\iisnode\interceptor.js:169:24)
at SyncWriteStream.stream.write.stream.end (C:\Program Files (x86)\iisnode\interceptor.js:174:26)
at Object.Console.<computed> (internal/console/constructor.js:255:12)
at Object.log (internal/console/constructor.js:300:26)
As indicated above, the problem is with interceptor.js, line 169:
return new Buffer(data, typeof encoding === 'string' ? encoding : 'utf8');
Based on https://nodejs.org/api/deprecations.html#DEP0005, I've changed this line to the following and no longer get the warning. In addition, a message truncation problem that has been plaguing me on a new Windows web server appears to have disappeared (hopefully for good ;-) ):
return Buffer.from(data, typeof encoding === 'string' ? encoding : 'utf8');
Did I get this update right? Perhaps there's a better fix -- or perhaps there's no need for a fix and I'm wrong-tree barking? Any guidance y'all could provide is appreciated.
Larry Rosenfeld
Applications Analyst, UNC-CH
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels