I\'m using Mocha / Chai to unit test a library that has recently started using nodejs\' Buffer objects to solve a different problem.
I get this error message in the
You might be using an old version of Node.js.
Buffer.from was introduced in version 6.0.0:
To make the creation of Buffer objects more reliable and less error prone, the various forms of the new Buffer() constructor have been deprecated and replaced by separate Buffer.from(), Buffer.alloc(), and Buffer.allocUnsafe() methods.
There's no reference to this method in previous versions of documentiation.
You could either update to 6.0.0 or use a deprecated constructor API, which has the following signature:
new Buffer(str[, encoding])