2
2
'use strict' ;
3
3
4
4
const binding = process . binding ( 'buffer' ) ;
5
- const internalUtil = require ( 'internal/util' ) ;
6
5
const bindingObj = { } ;
7
6
8
7
exports . Buffer = Buffer ;
@@ -522,10 +521,6 @@ Buffer.prototype.fill = function fill(val, start, end) {
522
521
} ;
523
522
524
523
525
- var writeWarned = false ;
526
- const writeMsg = 'Buffer.write(string, encoding, offset, length) is ' +
527
- 'deprecated. Use write(string[, offset[, length]]' +
528
- '[, encoding]) instead.' ;
529
524
Buffer . prototype . write = function ( string , offset , length , encoding ) {
530
525
// Buffer#write(string);
531
526
if ( offset === undefined ) {
@@ -550,14 +545,12 @@ Buffer.prototype.write = function(string, offset, length, encoding) {
550
545
encoding = length ;
551
546
length = undefined ;
552
547
}
553
-
554
- // XXX legacy write(string, encoding, offset, length) - remove in v0.13
555
548
} else {
556
- writeWarned = internalUtil . printDeprecationMessage ( writeMsg , writeWarned ) ;
557
- var swap = encoding ;
558
- encoding = offset ;
559
- offset = length >>> 0 ;
560
- length = swap ;
549
+ // if someone is still calling the obsolete form of write(), tell them.
550
+ // we don't want eg buf.write("foo", "utf8", 10) to silently turn into
551
+ // buf.write("foo", "utf8"), so we can't ignore extra args
552
+ throw new Error ( 'Buffer.write(string, encoding, offset[, length]) ' +
553
+ 'is no longer supported' ) ;
561
554
}
562
555
563
556
var remaining = this . length - offset ;
0 commit comments