aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tslint/lib/rules/encodingRule.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/tslint/lib/rules/encodingRule.js')
-rw-r--r--node_modules/tslint/lib/rules/encodingRule.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/node_modules/tslint/lib/rules/encodingRule.js b/node_modules/tslint/lib/rules/encodingRule.js
index 156d157a0..3fcd46590 100644
--- a/node_modules/tslint/lib/rules/encodingRule.js
+++ b/node_modules/tslint/lib/rules/encodingRule.js
@@ -66,7 +66,7 @@ function showEncoding(encoding) {
function detectEncoding(fileName) {
var fd = fs.openSync(fileName, "r");
var maxBytesRead = 3; // Only need 3 bytes to detect the encoding.
- var buffer = new Buffer(maxBytesRead);
+ var buffer = Buffer.allocUnsafe(maxBytesRead);
var bytesRead = fs.readSync(fd, buffer, /*offset*/ 0, /*length*/ maxBytesRead, /*position*/ 0);
fs.closeSync(fd);
return utils_1.detectBufferEncoding(buffer, bytesRead);