Skip to content

Commit

Permalink
Refactor buffer constructor (facebookarchive#1912)
Browse files Browse the repository at this point in the history
Summary:
**Summary**

This PR replaces `new Buffer` with `Buffer.from` and removes its deprecation warning.

The behavior of new Buffer() is different depending on the type of the first argument, security and reliability issues can be inadvertently introduced into applications when argument validation or Buffer initialization is not performed.

To make the creation of Buffer instances 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.

details: https://nodejs.org/api/buffer.html#buffer_buffer_from_buffer_alloc_and_buffer_allocunsafe
https://github.com/nodejs/Release#end-of-life-releases
Pull Request resolved: facebookarchive#1912

Differential Revision: D10481708

fbshipit-source-id: c4c2040133ee0bc82932de17c20fc5ca06d296c9
  • Loading branch information
noelyoo authored and jdecked committed Oct 8, 2019
1 parent d211dae commit cda63bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ gulp.task('css', function() {
}
},
);
file.contents = new Buffer(replaced);
file.contents = Buffer.from(replaced);
callback(null, file);
}),
)
Expand Down

0 comments on commit cda63bf

Please sign in to comment.