Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Commit 11d7379

Browse files
noelyoofacebook-github-bot
noelyoo
authored andcommitted
Refactor buffer constructor (#1912)
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: #1912 Differential Revision: D10481708 fbshipit-source-id: c4c2040133ee0bc82932de17c20fc5ca06d296c9
1 parent 1d3c77f commit 11d7379

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gulpfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ gulp.task('css', function() {
181181
}
182182
},
183183
);
184-
file.contents = new Buffer(replaced);
184+
file.contents = Buffer.from(replaced);
185185
callback(null, file);
186186
}),
187187
)

0 commit comments

Comments
 (0)