Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated Buffer.write(...) #5048

Closed
wants to merge 4 commits into from
Closed

Conversation

@dcposch
Copy link
Contributor

@dcposch dcposch commented Feb 3, 2016

It said:

// XXX legacy write(string, encoding, offset, length) - remove in v0.13

And we're just a few versions past that :)

@mikeal

@dcposch dcposch changed the title Remove deprecated code Remove deprecated Buffer.write(string, encoding, length, offset) Feb 3, 2016
@dcposch dcposch changed the title Remove deprecated Buffer.write(string, encoding, length, offset) Remove deprecated Buffer.write(...) Feb 3, 2016
@mscdex mscdex added the buffer label Feb 3, 2016
@@ -561,14 +557,6 @@ Buffer.prototype.write = function(string, offset, length, encoding) {
encoding = length;
length = undefined;
}

// XXX legacy write(string, encoding, offset, length) - remove in v0.13
} else {
Copy link
Contributor

@mscdex mscdex Feb 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps instead of flat out removing this branch, we should keep it and throw instead when isFinite(offset) is false?

Loading

Copy link
Contributor Author

@dcposch dcposch Feb 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buffer.fill(val, start, end) just coerces start and end to integers. This does the same with offset. Any calls that still use the old arguments (string, encoding, offset, length) will fail with an invalid encoding exception.

I can make it throw new Error("Buffer.write(string, encoding, offset, length) is no longer supported") -- do you prefer that?

Loading

Copy link
Contributor Author

@dcposch dcposch Feb 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loading

Copy link
Member

@ChALkeR ChALkeR Feb 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dcposch Will (string, encoding, offset) fail?

I'd prefer an explicit throw, at least for now.

Loading

@jasnell
Copy link
Member

@jasnell jasnell commented Feb 3, 2016

I'd be fine with removing it... but let's see what @nodejs/ctc says..

Loading

@rvagg
Copy link
Member

@rvagg rvagg commented Feb 3, 2016

@trevnorris this was yours, back in f489649, thoughts on whether it might even be used anywhere?

Personally I'd not be in such a hurry to remove things just because they can be, particularly when they don't incur much cost. But whatever.

Loading

@trevnorris
Copy link
Contributor

@trevnorris trevnorris commented Feb 4, 2016

@rvagg This legacy signature isn't even documented, and hasn't been since v0.10 IIRC. Plus it's had the deprecation warning in there for a while. I'd just like it removed b/c the argument parsing is ridiculous enough (takes up the first half of a 77 line function). But don't think it costs much performance wise leaving it there.

So +1 for removing it, but also won't be upset if it remains.

Loading

@thefourtheye
Copy link
Contributor

@thefourtheye thefourtheye commented Feb 4, 2016

cc @ChALkeR for user land usage analysis, though this might be difficult to find out.

Loading

@ChALkeR
Copy link
Member

@ChALkeR ChALkeR commented Feb 4, 2016

Update: ignore this, I was mistaken about which signature is deprecated.

Ow. Partial data from 2016-01-28 (partial because this is an exteremly simple search for anything that is named buf, buff, or buffer itself), downloads count per month on the left:

3442171 ws-1.0.1.tgz/lib/Sender.hixie.js:60:      buffer.write('\x00', 'binary');
3442171 ws-1.0.1.tgz/lib/Sender.hixie.js:54:      buffer.write('\x80', 'binary');
1912194 buffer-4.3.1.tgz/test/node/test-buffer.js:747:written = buf.write('abcd', 'utf8', 1, 2);  // legacy style
1005227 bson-0.4.21.tgz/browser_build/bson.js:361:    this.buffer.write(string, 'binary', offset);
286763  dicer-0.2.5.tgz/bench/parted-bench-multipart-parser.js:55:  buffer.write(tail, 'ascii', buffer.length - tail.length);
286763  dicer-0.2.5.tgz/bench/parted-bench-multipart-parser.js:54:  buffer.write(head, 'ascii', 0);
286763  dicer-0.2.5.tgz/bench/multiparty-bench-multipart-parser.js:60:  buffer.write(tail, 'ascii', buffer.length - tail.length);
286763  dicer-0.2.5.tgz/bench/multiparty-bench-multipart-parser.js:59:  buffer.write(head, 'ascii', 0);
286763  dicer-0.2.5.tgz/bench/multipartser-bench-multipart-parser.js:48:  buffer.write(tail, 'ascii', buffer.length - tail.length);
286763  dicer-0.2.5.tgz/bench/multipartser-bench-multipart-parser.js:47:  buffer.write(head, 'ascii', 0);
286763  dicer-0.2.5.tgz/bench/formidable-bench-multipart-parser.js:62:  buffer.write(tail, 'ascii', buffer.length - tail.length);
286763  dicer-0.2.5.tgz/bench/formidable-bench-multipart-parser.js:61:  buffer.write(head, 'ascii', 0);
286763  dicer-0.2.5.tgz/bench/dicer-bench-multipart-parser.js:55:  buffer.write(tail, 'ascii', buffer.length - tail.length);
286763  dicer-0.2.5.tgz/bench/dicer-bench-multipart-parser.js:54:  buffer.write(head, 'ascii', 0);
128324  ws-pure-0.8.0.tgz/lib/Sender.hixie.js:60:      buffer.write('\x00', 'binary');
128324  ws-pure-0.8.0.tgz/lib/Sender.hixie.js:54:      buffer.write('\x80', 'binary');
74246   mu2-0.5.20.tgz/lib/mu/parser.js:67:      buffer.write(content, 'utf8', 0);
45595   ref-1.3.2.tgz/test/reinterpretUntilZeros.js:28:    var len = buf.write(str, 'ucs2')
36280   bson-ext-0.1.13.tgz/lib/bson/binary.js:155:    this.buffer.write(string, 'binary', offset);
14264   diff-dom-2.0.0.tgz/venv/src/node-v4.1.1/test/parallel/test-buffer.js:745:written = buf.write('abcd', 'utf8', 1, 2);  // legacy style
14264   diff-dom-2.0.0.tgz/venv/src/node-v4.1.1/test/disabled/test-sendfd.js:95:  buf.write(JSON.stringify(DATA) + '\n', 'utf8');
10811   websocket.io-0.2.1.tgz/lib/protocols/drafts.js:204:    buffer.write('\x00', 'binary');
4732    cf-autoconfig-0.1.0.tgz/tests/test_modules/mongodb/lib/mongodb/gridfs/chunk.js:37:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
4732    cf-autoconfig-0.1.0.tgz/tests/test_modules/mongodb/lib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data, 'binary', 0);
3480    native-buffer-browserify-3.2.2.tgz/test/node/test-buffer.js:744:written = buf.write('abcd', 'utf8', 1, 2);  // legacy style
2274    bufferlist-0.1.0.tgz/examples/simple_binary.js:19:buf.write('\x00\x04meow', 'binary');
2145    ws-spec-0.4.20.tgz/lib/Sender.hixie.js:49:  if (writeStartMarker) buffer.write('\x00', 'binary');
2104    tingodb-0.4.2.tgz/lib/tbinary.js:185:    this.buffer.write(string, 'binary', offset);
2045    websocket.io-spec-0.2.1.tgz/lib/protocols/drafts.js:204:    buffer.write('\x00', 'binary');
1468    streamws-0.1.1.tgz/lib/Sender.hixie.js:49:  if (writeStartMarker) buffer.write('\x00', 'binary');
1068    connect-form-0.2.1.tgz/support/connect/lib/connect/middleware/cache.js:92:                buffer.write(chunk, encoding);
918 sc-ws-1.0.1.tgz/lib/Sender.hixie.js:60:      buffer.write('\x00', 'binary');
918 sc-ws-1.0.1.tgz/lib/Sender.hixie.js:54:      buffer.write('\x80', 'binary');
865 x11-2.0.5.tgz/lib/unpackstream.js:205:    buf.write(str, 'binary');
800 butils-0.1.0.tgz/test/index.js:315:            buf.write('test', 'utf8', 0);
800 butils-0.1.0.tgz/bench.js:61:    buf.write('test', 'utf8', 0);
721 priam-2.0.1.tgz/test/unit/driver.execution.tests.js:1680:          buffer.write('This is a string buffer', 'utf-8');
610 bip-pod-flow-0.3.21.tgz/file_to_text.js:52:                  buf.write(chunk.toString(), 'utf-8');
337 blockchain-wallet-client-prebuilt-3.4.1.tgz/modules/ws/lib/Sender.hixie.js:60:      buffer.write('\x00', 'binary');
337 blockchain-wallet-client-prebuilt-3.4.1.tgz/modules/ws/lib/Sender.hixie.js:54:      buffer.write('\x80', 'binary');
319 multipart-parser-0.0.2.tgz/benchmark/helper.js:70:  buffer.write(tail, 'ascii', buffer.length - tail.length);
319 multipart-parser-0.0.2.tgz/benchmark/helper.js:69:  buffer.write(head, 'ascii', 0);
310 wspp-0.8.0.tgz/lib/Sender.hixie.js:60:      buffer.write('\x00', 'binary');
310 wspp-0.8.0.tgz/lib/Sender.hixie.js:54:      buffer.write('\x80', 'binary');
304 bluefire-0.0.5.tgz/parser/Packet.coffee:203:        buffer.write(data, "ascii")
246 mongous-0.2.7.tgz/gridfs/chunk.js:21:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
246 mongous-0.2.7.tgz/gridfs/chunk.js:17:    buffer.write(mongoObjectFinal.data, 'binary', 0);
246 mongous-0.2.7.tgz/bson/binary.js:73:      this.buffer.write(string, 'binary', offset);
229 bip-pod-gmail-0.3.11.tgz/index.js:178:                              buff.write(part.body.data, 'base64');
221 wheat-0.2.6.tgz/lib/wheat/tools.js:47:  buffer.write(string, 'utf8');
207 anvil.http-0.1.1.tgz/lib/http.js:157:                   buffer.write( chunk, encoding );
178 marcrecord-0.0.15.tgz/lib/isowriter.js:223:    buffer.write(field.ind1 + field.ind2, 'ascii');
146 mongodb-minimal-2015.8.1.tgz/bson/browser_build/bson.js:361:    this.buffer.write(string, 'binary', offset);
134 tokumx-1.4.0-rc8.tgz/lib/mongodb/gridfs/chunk.js:37:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
134 tokumx-1.4.0-rc8.tgz/lib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data, 'binary', 0);
132 maltose-ws-0.0.4.tgz/ws/lib/Sender.hixie.js:59:      buffer.write('\x00', 'binary');
132 maltose-ws-0.0.4.tgz/ws/lib/Sender.hixie.js:53:      buffer.write('\x80', 'binary');
132 connect-oauth-0.4.5.tgz/test/lib/connect/middleware/cache.js:91:                buffer.write(chunk, encoding);
125 cloud9-0.5.1.tgz/support/socket.io/lib/transports/websocket/default.js:179:    buffer.write('\u0000', 'binary');
125 cloud9-0.5.1.tgz/support/jsdav/support/formidable/test/simple/test-multipart-parser.js:37:  buffer.write('--ad', 'ascii', 0);
125 cloud9-0.5.1.tgz/support/jsdav/support/formidable/test/integration/test-multipart-parser.js:53:  buffer.write(fixture.raw, 'binary', 0);
125 cloud9-0.5.1.tgz/support/jsdav/support/formidable/benchmark/bench-multipart-parser.js:62:  buffer.write(tail, 'ascii', buffer.length - tail.length);
125 cloud9-0.5.1.tgz/support/jsdav/support/formidable/benchmark/bench-multipart-parser.js:61:  buffer.write(head, 'ascii', 0);
125 cloud9-0.5.1.tgz/support/connect/lib/connect/middleware/cache.js:92:                buffer.write(chunk, encoding);
112 socket.io-agilelaw-0.9.16-3-agilelaw.tgz/lib/transports/websocket/default.js:198:    buffer.write('\x00', 'binary');
101 jdf-ws-1.0.3.tgz/ws/lib/Sender.hixie.js:59:      buffer.write('\x00', 'binary');
101 jdf-ws-1.0.3.tgz/ws/lib/Sender.hixie.js:53:      buffer.write('\x80', 'binary');
100 node-asset-0.1.6.tgz/lib/index.js:242:  buffer.write(data, 'binary', 0);
99  gch-truefx-pricefeed-0.0.9.tgz/example/client/components/socket.io/lib/transports/websocket/default.js:196:    buffer.write('\x00', 'binary');
93  gpt-0.5.0.tgz/lib/guid.js:47:    this._buffer.write( string, 'hex' )
92  mu-0.5.2.tgz/lib/mu/parser.js:62:      buffer.write(content, 'utf8', 0);
91  socket.io.bwillard-1.0.0.tgz/lib/transports/websocket/default.js:189:    buffer.write('\x00', 'binary');
90  live-mu-0.5.19.tgz/lib/mu/parser.js:67:      buffer.write(content, 'utf8', 0);
89  burst-0.0.3.tgz/lib/burst.js:20:    buf.write(data, 'binary', 0);
81  duplexbufferstream-0.0.4.tgz/lib/duplexbufferstream.js:35:  chunkbuffer.write(chunk, encoding);
76  video-2.0.0.tgz/tests/full-frames/tovideo.js:23:    buf.write(terminal, 'binary');
76  video-2.0.0.tgz/discovery/full-frames/topng.js:18:    buf.write(terminal, 'binary');
62  formidable-plus-1.0.12.tgz/test/legacy/simple/test-multipart-parser.js:37:  buffer.write('--ad', 'ascii', 0);
62  formidable-plus-1.0.12.tgz/test/legacy/integration/test-multipart-parser.js:53:  buffer.write(fixture.raw, 'binary', 0);
62  formidable-plus-1.0.12.tgz/benchmark/bench-multipart-parser.js:62:  buffer.write(tail, 'ascii', buffer.length - tail.length);
62  formidable-plus-1.0.12.tgz/benchmark/bench-multipart-parser.js:61:  buffer.write(head, 'ascii', 0);
61  devil-windows-0.1.4.tgz/lib/ws/lib/Sender.hixie.js:54:      buffer.write('\x00', 'binary');
61  devil-windows-0.1.4.tgz/lib/ws/lib/Sender.hixie.js:48:      buffer.write('\x80', 'binary');
60  covalent-0.2.1.tgz/lib/covalent.js:8870:          buffer.write(", ");
60  covalent-0.2.1.tgz/lib/covalent.js:8778:      buffer.write("self.context.set(\"" + cellSet + "\", ");
60  covalent-0.2.1.tgz/lib/covalent.js:8730:      buffer.write(args.join(", "));
60  covalent-0.2.1.tgz/lib/covalent.js:8712:          buffer.write(", ");
60  covalent-0.2.1.tgz/lib/covalent.js:8707:      buffer.write(".call(self, ");
60  biojs-vis-blast-0.1.5.tgz/node/test/simple/test-buffer.js:763:written = buf.write('abcd', 'utf8', 1, 2);  // legacy style
60  biojs-vis-blast-0.1.5.tgz/node/test/disabled/test-sendfd.js:118:  buf.write(JSON.stringify(DATA) + '\n', 'utf8');
48  pedig.io-0.9.19.tgz/lib/transports/websocket/default.js:196:    buffer.write('\x00', 'binary');
43  flush-all-0.1.1.tgz/node-v0.13/test/simple/test-buffer.js:763:written = buf.write('abcd', 'utf8', 1, 2);  // legacy style
43  flush-all-0.1.1.tgz/node-v0.13/test/disabled/test-sendfd.js:118:  buf.write(JSON.stringify(DATA) + '\n', 'utf8');
42  mongoose3-bsonfix-mongodb-1.4.91.tgz/lib/mongodb/gridfs/chunk.js:37:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
42  mongoose3-bsonfix-mongodb-1.4.91.tgz/lib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data, 'binary', 0);
41  basalt-1.0.1.tgz/lib/bson_common.js:161:  this.buffer.write(string, 'binary', offset);
40  socket.io-wisdom-0.8.7-0.tgz/lib/transports/websocket/default.js:189:    buffer.write('\x00', 'binary');
40  logmonger-0.1.0.tgz/contrib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
40  logmonger-0.1.0.tgz/contrib/mongodb/gridfs/chunk.js:29:    buffer.write(mongoObjectFinal.data, 'binary', 0);
40  logmonger-0.1.0.tgz/contrib/mongodb/bson/bson.js:619:  this.buffer.write(string, 'binary', offset);
40  logmonger-0.1.0.tgz/contrib/connect/middleware/cache.js:92:                buffer.write(chunk, encoding);
40  compressor-0.1.10.tgz/lib/compress/index.js:154:      buffer.write(data, encoding, 0);
40  athena-ws-0.0.1.tgz/ws/lib/Sender.hixie.js:59:      buffer.write('\x00', 'binary');
40  athena-ws-0.0.1.tgz/ws/lib/Sender.hixie.js:53:      buffer.write('\x80', 'binary');
38  tensor-socket.io-0.9.17-t2.tgz/lib/transports/websocket/default.js:196:    buffer.write('\x00', 'binary');
38  postgres-js-0.1.0.tgz/lib/postgres-pure.js:41:      buffer.write(header, 'ascii', offset);
38  node-core-test-simple-0.11.11.tgz/test-buffer.js:753:written = buf.write('abcd', 'utf8', 1, 2);  // legacy style
37  x265js-0.7.1-2.tgz/examples/example.js:357: //buffer.write("Test string!!", "utf-8");
37  x265js-0.7.1-2.tgz/examples/example.js:316:    //buffer.write("Test string!!", "utf-8");
37  tabler-0.0.1.tgz/lib/stringtabler_jsonfile.js:1114:        bytesWritten = buffer.write(stringLeft, 'utf8'); // Will not write partial characters if too long (see doc)
37  mongodb4haiku-0.9.9-6.tgz/lib/mongodb/gridfs/chunk.js:37:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
37  mongodb4haiku-0.9.9-6.tgz/lib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data, 'binary', 0);
36  connect-session-redis-store-0.0.2.tgz/support/connect/lib/connect/middleware/cache.js:91:                buffer.write(chunk, encoding);
36  barley-0.0.1.tgz/lib/wheat/tools.js:47:  buffer.write(string, 'utf8');
35  eggdb-bson-0.0.2.tgz/lib/bson/binary.js:155:    this.buffer.write(string, 'binary', offset);
35  11zwheat-0.2.6.tgz/lib/wheat/tools.js:51:  buffer.write(string, 'utf8');
34  ws-interface-0.7.4.tgz/lib/Sender.hixie.js:60:      buffer.write('\x00', 'binary');
34  ws-interface-0.7.4.tgz/lib/Sender.hixie.js:54:      buffer.write('\x80', 'binary');
34  ocplatform-0.1.3.tgz/lib/mvc/Nut.js:308:                nut.view.buff.write(nut.view._children[name].buff,"unuse") ;
34  ocplatform-0.1.3.tgz/lib/mvc/Nut.js:269:                    nut.view.buff.write(msgbuffs[i],"unused",true) ;
34  jaydata-mongodb-driver-1.1.7.tgz/lib/mongodb/gridfs/chunk.js:37:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
34  jaydata-mongodb-driver-1.1.7.tgz/lib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data, 'binary', 0);
34  fuseql-1.0.2.tgz/lib/main.js:185:        buffer.write(content, 'utf-8');
34  fuseql-1.0.2.tgz/lib/demofs.js:129:      buffer.write(content, 'utf-8');
34  anvil.phantom-0.0.1.tgz/src/phantom.js:55:                  buffer.write( chunk, encoding );
34  anvil.phantom-0.0.1.tgz/lib/phantom.js:64:                  buffer.write( chunk, encoding );
32  socket.io-patched-manager-0.9.13.tgz/lib/transports/websocket/default.js:191:    buffer.write('\x00', 'binary');
32  ref-prebuilt-0.1.3.tgz/test/reinterpret.js:57:      var len = buf.write(str, 'ucs2')
32  mongodb-thesmart-0.0.1.tgz/lib/mongodb/gridfs/chunk.js:37:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
32  mongodb-thesmart-0.0.1.tgz/lib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data, 'binary', 0);
32  leefs-0.0.1.tgz/socket.io/lib/transports/websocket/default.js:192:    buffer.write('\x00', 'binary');
31  nsmarty-0.0.1.tgz/lib/nsmarty/parser.js:62:         buffer.write(content, 'utf8', 0);
31  loadmeter-0.0.2.tgz/pakmanaged.js:3167:        this.buffer.write(string, 'binary', offset);
30  ws-phni-0.4.25.tgz/lib/Sender.hixie.js:59:      buffer.write('\x00', 'binary');
30  ws-phni-0.4.25.tgz/lib/Sender.hixie.js:53:      buffer.write('\x80', 'binary');
30  ffi-shyp-0.1.0.tgz/ref/test/reinterpret.js:57:      var len = buf.write(str, 'ucs2')
29  mongoose3-bsonfix-bson-0.2.90.tgz/lib/bson/binary.js:155:    this.buffer.write(string, 'binary', offset);
29  mongoose3-bsonfix-bson-0.2.90.tgz/browser_build/bson.js:361:    this.buffer.write(string, 'binary', offset);
29  megaice-0.0.1.tgz/socket.io/lib/transports/websocket/default.js:191:    buffer.write('\x00', 'binary');
29  megaice-0.0.1.tgz/mongodb/lib/mongodb/gridfs/chunk.js:37:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
29  megaice-0.0.1.tgz/mongodb/lib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data, 'binary', 0);
29  megaice-0.0.1.tgz/formidable/test/legacy/simple/test-multipart-parser.js:37:  buffer.write('--ad', 'ascii', 0);
29  megaice-0.0.1.tgz/formidable/test/legacy/integration/test-multipart-parser.js:53:  buffer.write(fixture.raw, 'binary', 0);
29  megaice-0.0.1.tgz/formidable/benchmark/bench-multipart-parser.js:62:  buffer.write(tail, 'ascii', buffer.length - tail.length);
29  megaice-0.0.1.tgz/formidable/benchmark/bench-multipart-parser.js:61:  buffer.write(head, 'ascii', 0);
29  megaice-0.0.1.tgz/connect-form/support/connect/lib/connect/middleware/cache.js:92:                buffer.write(chunk, encoding);
28  doxmake-0.1.29.tgz/relayCode/mu2/lib/mu/parser.js:67:      buffer.write(content, 'utf8', 0);
27  surepost-socket.io-0.9.16.tgz/lib/transports/websocket/default.js:196:    buffer.write('\x00', 'binary');
25  pezhu-0.0.0.tgz/.npm/formidable/1.0.14/package/test/legacy/simple/test-multipart-parser.js:37:  buffer.write('--ad', 'ascii', 0);
25  pezhu-0.0.0.tgz/.npm/formidable/1.0.14/package/test/legacy/integration/test-multipart-parser.js:53:  buffer.write(fixture.raw, 'binary', 0);
25  pezhu-0.0.0.tgz/.npm/formidable/1.0.14/package/benchmark/bench-multipart-parser.js:63:  buffer.write(tail, 'ascii', buffer.length - tail.length);
25  pezhu-0.0.0.tgz/.npm/formidable/1.0.14/package/benchmark/bench-multipart-parser.js:62:  buffer.write(head, 'ascii', 0);
25  pezhu-0.0.0.tgz/Downloads/node-v0.9.11/test/simple/test-buffer.js:805:buf.write('00010203040506070809', 'hex');
25  pezhu-0.0.0.tgz/Downloads/node-v0.9.11/test/simple/test-buffer.js:803:buf.write('123456', 'base64');
25  pezhu-0.0.0.tgz/Downloads/node-v0.9.11/test/simple/test-buffer.js:801:buf.write('0123456789', 'binary');
25  pezhu-0.0.0.tgz/Downloads/node-v0.9.11/test/simple/test-buffer.js:799:buf.write('0123456789', 'ascii');
25  pezhu-0.0.0.tgz/Downloads/node-v0.9.11/test/simple/test-buffer.js:796:  buf.write('あいうえお', encoding); // 2bytes * 5
25  pezhu-0.0.0.tgz/Downloads/node-v0.9.11/test/simple/test-buffer.js:793:buf.write('あいうえ', 'utf8'); // 3bytes * 4
25  pezhu-0.0.0.tgz/Downloads/node-v0.9.11/test/simple/test-buffer.js:756:written = buf.write('abcd', 'utf8', 1, 2);  // legacy style
25  pezhu-0.0.0.tgz/Downloads/node-v0.9.11/test/simple/test-buffer.js:34:  buf.write('', encoding);
25  pezhu-0.0.0.tgz/Downloads/node-v0.9.11/test/disabled/test-sendfd.js:118:  buf.write(JSON.stringify(DATA) + '\n', 'utf8');
25  nlog-0.0.1.tgz/lib/renderer.js:204:  buffer.write(layout, 'utf8');
23  ws-non-native-0.4.31.tgz/lib/Sender.hixie.js:54:      buffer.write('\x00', 'binary');
23  ws-non-native-0.4.31.tgz/lib/Sender.hixie.js:48:      buffer.write('\x80', 'binary');
23  connect-jsonrpc-0.0.1.tgz/support/connect/lib/connect/middleware/cache.js:91:                buffer.write(chunk, encoding);
22  surespot-socket.io-0.9.16.tgz/lib/transports/websocket/default.js:196:    buffer.write('\x00', 'binary');
22  stackvm-0.0.5.tgz/bin/screencasts.js:54:        buf.write(frame, 'binary');
22  stackvm-0.0.5.tgz/bin/screencasts.js:47:        buf.write(frame, 'binary');
22  sharedesk.at-0.0.1.tgz/lib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
22  sharedesk.at-0.0.1.tgz/lib/mongodb/gridfs/chunk.js:29:    buffer.write(mongoObjectFinal.data, 'binary', 0);
22  sharedesk.at-0.0.1.tgz/lib/mongodb/bson/bson.js:617:  this.buffer.write(string, 'binary', offset);
22  mongodb_heroku-0.9.4-5.tgz/lib/mongodb/gridfs/chunk.js:35:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
22  mongodb_heroku-0.9.4-5.tgz/lib/mongodb/gridfs/chunk.js:31:    buffer.write(mongoObjectFinal.data, 'binary', 0);
22  mongodb_heroku-0.9.4-5.tgz/lib/mongodb/bson/binary.js:73:     this.buffer.write(string, 'binary', offset);
21  socket.io-persistence-0.0.4.tgz/lib/transports/websocket/default.js:191:    buffer.write('\x00', 'binary');
21  server-kit-dicer-0.2.4.tgz/bench/parted-bench-multipart-parser.js:55:  buffer.write(tail, 'ascii', buffer.length - tail.length);
21  server-kit-dicer-0.2.4.tgz/bench/parted-bench-multipart-parser.js:54:  buffer.write(head, 'ascii', 0);
21  server-kit-dicer-0.2.4.tgz/bench/multiparty-bench-multipart-parser.js:60:  buffer.write(tail, 'ascii', buffer.length - tail.length);
21  server-kit-dicer-0.2.4.tgz/bench/multiparty-bench-multipart-parser.js:59:  buffer.write(head, 'ascii', 0);
21  server-kit-dicer-0.2.4.tgz/bench/multipartser-bench-multipart-parser.js:48:  buffer.write(tail, 'ascii', buffer.length - tail.length);
21  server-kit-dicer-0.2.4.tgz/bench/multipartser-bench-multipart-parser.js:47:  buffer.write(head, 'ascii', 0);
21  server-kit-dicer-0.2.4.tgz/bench/formidable-bench-multipart-parser.js:62:  buffer.write(tail, 'ascii', buffer.length - tail.length);
21  server-kit-dicer-0.2.4.tgz/bench/formidable-bench-multipart-parser.js:61:  buffer.write(head, 'ascii', 0);
21  server-kit-dicer-0.2.4.tgz/bench/dicer-bench-multipart-parser.js:55:  buffer.write(tail, 'ascii', buffer.length - tail.length);
21  server-kit-dicer-0.2.4.tgz/bench/dicer-bench-multipart-parser.js:54:  buffer.write(head, 'ascii', 0);
20  compress-ds-0.1.11.tgz/lib/compress/index.js:147:      buffer.write(data, encoding, 0);
19  sherlogjs-0.1.0.tgz/app/common/utils.js:14:  buffer.write('R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=', 'base64');
18  olorin-0.0.1.tgz/pakmanaged.js:3788:          buffer.write('\x00', 'binary');
18  olorin-0.0.1.tgz/pakmanaged.js:3782:          buffer.write('\x80', 'binary');
18  blankgif-0.1.0.tgz/index.js:3:  buff.write("R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=", "base64");
17  ref-atom-shell-2.0.0.tgz/test/reinterpretUntilZeros.js:28:    var len = buf.write(str, 'ucs2')

Update: ignore this, I was mistaken about which signature is deprecated.

Loading

@thefourtheye
Copy link
Contributor

@thefourtheye thefourtheye commented Feb 4, 2016

@ChALkeR Most of them don't look like the one which we are trying to deprecate here :D As I said, it would be a little tricky to search. Probably something like
/\.write\s*\(\s*'.*?'\s*,\s*'.*?'\s*,\s*\d+\s*,\s*\d+\s*\)/?

Loading

@ChALkeR
Copy link
Member

@ChALkeR ChALkeR commented Feb 4, 2016

@thefourtheye Ah, I misread the change, that was a mistake on my side. Sorry. I will update this soon.

Loading

@ChALkeR
Copy link
Member

@ChALkeR ChALkeR commented Feb 4, 2016

@thefourtheye Updated. Note that .write(string, encoding, offset) is also deprecated.

Once again: note that this is partial, because this is an exteremly simple search for anything that is named buf, buff, or buffer itself. Downloads count per month on the left:

1912194 buffer-4.3.1.tgz/test/node/test-buffer.js:747:written = buf.write('abcd', 'utf8', 1, 2);  // legacy style
1005227 bson-0.4.21.tgz/browser_build/bson.js:361:    this.buffer.write(string, 'binary', offset);
286763  dicer-0.2.5.tgz/bench/parted-bench-multipart-parser.js:55:  buffer.write(tail, 'ascii', buffer.length - tail.length);
286763  dicer-0.2.5.tgz/bench/parted-bench-multipart-parser.js:54:  buffer.write(head, 'ascii', 0);
286763  dicer-0.2.5.tgz/bench/multiparty-bench-multipart-parser.js:60:  buffer.write(tail, 'ascii', buffer.length - tail.length);
286763  dicer-0.2.5.tgz/bench/multiparty-bench-multipart-parser.js:59:  buffer.write(head, 'ascii', 0);
286763  dicer-0.2.5.tgz/bench/multipartser-bench-multipart-parser.js:48:  buffer.write(tail, 'ascii', buffer.length - tail.length);
286763  dicer-0.2.5.tgz/bench/multipartser-bench-multipart-parser.js:47:  buffer.write(head, 'ascii', 0);
286763  dicer-0.2.5.tgz/bench/formidable-bench-multipart-parser.js:62:  buffer.write(tail, 'ascii', buffer.length - tail.length);
286763  dicer-0.2.5.tgz/bench/formidable-bench-multipart-parser.js:61:  buffer.write(head, 'ascii', 0);
286763  dicer-0.2.5.tgz/bench/dicer-bench-multipart-parser.js:55:  buffer.write(tail, 'ascii', buffer.length - tail.length);
286763  dicer-0.2.5.tgz/bench/dicer-bench-multipart-parser.js:54:  buffer.write(head, 'ascii', 0);
74246   mu2-0.5.20.tgz/lib/mu/parser.js:67:      buffer.write(content, 'utf8', 0);
36280   bson-ext-0.1.13.tgz/lib/bson/binary.js:155:    this.buffer.write(string, 'binary', offset);
14264   diff-dom-2.0.0.tgz/venv/src/node-v4.1.1/test/parallel/test-buffer.js:745:written = buf.write('abcd', 'utf8', 1, 2);  // legacy style
4732    cf-autoconfig-0.1.0.tgz/tests/test_modules/mongodb/lib/mongodb/gridfs/chunk.js:37:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
4732    cf-autoconfig-0.1.0.tgz/tests/test_modules/mongodb/lib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data, 'binary', 0);
3480    native-buffer-browserify-3.2.2.tgz/test/node/test-buffer.js:744:written = buf.write('abcd', 'utf8', 1, 2);  // legacy style
2104    tingodb-0.4.2.tgz/lib/tbinary.js:185:    this.buffer.write(string, 'binary', offset);
1779    http-stack-0.1.3.tgz/base.js:51:    pos += buf.write(chunk, enc, pos);
800 butils-0.1.0.tgz/test/index.js:315:            buf.write('test', 'utf8', 0);
800 butils-0.1.0.tgz/bench.js:61:    buf.write('test', 'utf8', 0);
319 multipart-parser-0.0.2.tgz/benchmark/helper.js:70:  buffer.write(tail, 'ascii', buffer.length - tail.length);
319 multipart-parser-0.0.2.tgz/benchmark/helper.js:69:  buffer.write(head, 'ascii', 0);
246 mongous-0.2.7.tgz/gridfs/chunk.js:21:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
246 mongous-0.2.7.tgz/gridfs/chunk.js:17:    buffer.write(mongoObjectFinal.data, 'binary', 0);
246 mongous-0.2.7.tgz/bson/binary.js:73:      this.buffer.write(string, 'binary', offset);
193 squish-0.2.3.tgz/lib/squish.js:25:      buf.write(str, enc, 0);
146 mongodb-minimal-2015.8.1.tgz/bson/browser_build/bson.js:361:    this.buffer.write(string, 'binary', offset);
140 stream-pair-1.0.3.tgz/lib/stream-pair.js:43:  this.other.buffer.write(data, enc, cb);
134 tokumx-1.4.0-rc8.tgz/lib/mongodb/gridfs/chunk.js:37:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
134 tokumx-1.4.0-rc8.tgz/lib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data, 'binary', 0);
126 opencomb-0.9.7.tgz/lib/mvc/Nut.js:296:                    nut.view.buff.write(msgbuffs[i],"unused",true) ;
125 cloud9-0.5.1.tgz/support/jsdav/support/formidable/test/simple/test-multipart-parser.js:37:  buffer.write('--ad', 'ascii', 0);
125 cloud9-0.5.1.tgz/support/jsdav/support/formidable/test/integration/test-multipart-parser.js:53:  buffer.write(fixture.raw, 'binary', 0);
125 cloud9-0.5.1.tgz/support/jsdav/support/formidable/benchmark/bench-multipart-parser.js:62:  buffer.write(tail, 'ascii', buffer.length - tail.length);
125 cloud9-0.5.1.tgz/support/jsdav/support/formidable/benchmark/bench-multipart-parser.js:61:  buffer.write(head, 'ascii', 0);
100 node-asset-0.1.6.tgz/lib/index.js:242:  buffer.write(data, 'binary', 0);
92  mu-0.5.2.tgz/lib/mu/parser.js:62:      buffer.write(content, 'utf8', 0);
90  live-mu-0.5.19.tgz/lib/mu/parser.js:67:      buffer.write(content, 'utf8', 0);
89  burst-0.0.3.tgz/lib/burst.js:20:    buf.write(data, 'binary', 0);
62  formidable-plus-1.0.12.tgz/test/legacy/simple/test-multipart-parser.js:37:  buffer.write('--ad', 'ascii', 0);
62  formidable-plus-1.0.12.tgz/test/legacy/integration/test-multipart-parser.js:53:  buffer.write(fixture.raw, 'binary', 0);
62  formidable-plus-1.0.12.tgz/benchmark/bench-multipart-parser.js:62:  buffer.write(tail, 'ascii', buffer.length - tail.length);
62  formidable-plus-1.0.12.tgz/benchmark/bench-multipart-parser.js:61:  buffer.write(head, 'ascii', 0);
60  biojs-vis-blast-0.1.5.tgz/node/test/simple/test-buffer.js:763:written = buf.write('abcd', 'utf8', 1, 2);  // legacy style
43  flush-all-0.1.1.tgz/node-v0.13/test/simple/test-buffer.js:763:written = buf.write('abcd', 'utf8', 1, 2);  // legacy style
42  mongoose3-bsonfix-mongodb-1.4.91.tgz/lib/mongodb/gridfs/chunk.js:37:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
42  mongoose3-bsonfix-mongodb-1.4.91.tgz/lib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data, 'binary', 0);
41  basalt-1.0.1.tgz/lib/bson_common.js:161:  this.buffer.write(string, 'binary', offset);
40  logmonger-0.1.0.tgz/contrib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
40  logmonger-0.1.0.tgz/contrib/mongodb/gridfs/chunk.js:29:    buffer.write(mongoObjectFinal.data, 'binary', 0);
40  logmonger-0.1.0.tgz/contrib/mongodb/bson/bson.js:619:  this.buffer.write(string, 'binary', offset);
40  compressor-0.1.10.tgz/lib/compress/index.js:154:      buffer.write(data, encoding, 0);
40  compressor-0.1.10.tgz/demo/demo.js:57:  buf.write(str, enc, 0);
38  postgres-js-0.1.0.tgz/lib/postgres-pure.js:41:      buffer.write(header, 'ascii', offset);
38  node-core-test-simple-0.11.11.tgz/test-buffer.js:753:written = buf.write('abcd', 'utf8', 1, 2);  // legacy style
37  mongodb4haiku-0.9.9-6.tgz/lib/mongodb/gridfs/chunk.js:37:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
37  mongodb4haiku-0.9.9-6.tgz/lib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data, 'binary', 0);
35  eggdb-bson-0.0.2.tgz/lib/bson/binary.js:155:    this.buffer.write(string, 'binary', offset);
34  ocplatform-0.1.3.tgz/lib/mvc/Nut.js:269:                    nut.view.buff.write(msgbuffs[i],"unused",true) ;
34  jaydata-mongodb-driver-1.1.7.tgz/lib/mongodb/gridfs/chunk.js:37:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
34  jaydata-mongodb-driver-1.1.7.tgz/lib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data, 'binary', 0);
32  mongodb-thesmart-0.0.1.tgz/lib/mongodb/gridfs/chunk.js:37:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
32  mongodb-thesmart-0.0.1.tgz/lib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data, 'binary', 0);
31  nsmarty-0.0.1.tgz/lib/nsmarty/parser.js:62:         buffer.write(content, 'utf8', 0);
31  loadmeter-0.0.2.tgz/pakmanaged.js:3167:        this.buffer.write(string, 'binary', offset);
29  mongoose3-bsonfix-bson-0.2.90.tgz/lib/bson/binary.js:155:    this.buffer.write(string, 'binary', offset);
29  mongoose3-bsonfix-bson-0.2.90.tgz/browser_build/bson.js:361:    this.buffer.write(string, 'binary', offset);
29  megaice-0.0.1.tgz/mongodb/lib/mongodb/gridfs/chunk.js:37:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
29  megaice-0.0.1.tgz/mongodb/lib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data, 'binary', 0);
29  megaice-0.0.1.tgz/formidable/test/legacy/simple/test-multipart-parser.js:37:  buffer.write('--ad', 'ascii', 0);
29  megaice-0.0.1.tgz/formidable/test/legacy/integration/test-multipart-parser.js:53:  buffer.write(fixture.raw, 'binary', 0);
29  megaice-0.0.1.tgz/formidable/benchmark/bench-multipart-parser.js:62:  buffer.write(tail, 'ascii', buffer.length - tail.length);
29  megaice-0.0.1.tgz/formidable/benchmark/bench-multipart-parser.js:61:  buffer.write(head, 'ascii', 0);
28  doxmake-0.1.29.tgz/relayCode/mu2/lib/mu/parser.js:67:      buffer.write(content, 'utf8', 0);
25  pezhu-0.0.0.tgz/.npm/formidable/1.0.14/package/test/legacy/simple/test-multipart-parser.js:37:  buffer.write('--ad', 'ascii', 0);
25  pezhu-0.0.0.tgz/.npm/formidable/1.0.14/package/test/legacy/integration/test-multipart-parser.js:53:  buffer.write(fixture.raw, 'binary', 0);
25  pezhu-0.0.0.tgz/.npm/formidable/1.0.14/package/benchmark/bench-multipart-parser.js:63:  buffer.write(tail, 'ascii', buffer.length - tail.length);
25  pezhu-0.0.0.tgz/.npm/formidable/1.0.14/package/benchmark/bench-multipart-parser.js:62:  buffer.write(head, 'ascii', 0);
25  pezhu-0.0.0.tgz/Downloads/node-v0.9.11/test/simple/test-buffer.js:756:written = buf.write('abcd', 'utf8', 1, 2);  // legacy style
22  sharedesk.at-0.0.1.tgz/lib/mongodb/gridfs/chunk.js:33:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
22  sharedesk.at-0.0.1.tgz/lib/mongodb/gridfs/chunk.js:29:    buffer.write(mongoObjectFinal.data, 'binary', 0);
22  sharedesk.at-0.0.1.tgz/lib/mongodb/bson/bson.js:617:  this.buffer.write(string, 'binary', offset);
22  mongodb_heroku-0.9.4-5.tgz/lib/mongodb/gridfs/chunk.js:35:    buffer.write(mongoObjectFinal.data.join(''), 'binary', 0);
22  mongodb_heroku-0.9.4-5.tgz/lib/mongodb/gridfs/chunk.js:31:    buffer.write(mongoObjectFinal.data, 'binary', 0);
22  mongodb_heroku-0.9.4-5.tgz/lib/mongodb/bson/binary.js:73:     this.buffer.write(string, 'binary', offset);
21  server-kit-dicer-0.2.4.tgz/bench/parted-bench-multipart-parser.js:55:  buffer.write(tail, 'ascii', buffer.length - tail.length);
21  server-kit-dicer-0.2.4.tgz/bench/parted-bench-multipart-parser.js:54:  buffer.write(head, 'ascii', 0);
21  server-kit-dicer-0.2.4.tgz/bench/multiparty-bench-multipart-parser.js:60:  buffer.write(tail, 'ascii', buffer.length - tail.length);
21  server-kit-dicer-0.2.4.tgz/bench/multiparty-bench-multipart-parser.js:59:  buffer.write(head, 'ascii', 0);
21  server-kit-dicer-0.2.4.tgz/bench/multipartser-bench-multipart-parser.js:48:  buffer.write(tail, 'ascii', buffer.length - tail.length);
21  server-kit-dicer-0.2.4.tgz/bench/multipartser-bench-multipart-parser.js:47:  buffer.write(head, 'ascii', 0);
21  server-kit-dicer-0.2.4.tgz/bench/formidable-bench-multipart-parser.js:62:  buffer.write(tail, 'ascii', buffer.length - tail.length);
21  server-kit-dicer-0.2.4.tgz/bench/formidable-bench-multipart-parser.js:61:  buffer.write(head, 'ascii', 0);
21  server-kit-dicer-0.2.4.tgz/bench/dicer-bench-multipart-parser.js:55:  buffer.write(tail, 'ascii', buffer.length - tail.length);
21  server-kit-dicer-0.2.4.tgz/bench/dicer-bench-multipart-parser.js:54:  buffer.write(head, 'ascii', 0);
20  compress-ds-0.1.11.tgz/lib/compress/index.js:147:      buffer.write(data, encoding, 0);
20  compress-ds-0.1.11.tgz/demo/demo.js:57:  buf.write(str, enc, 0);

/cc @mscdex for dicer, @christkv for bson and bson-ext.

Loading

@thefourtheye
Copy link
Contributor

@thefourtheye thefourtheye commented Feb 4, 2016

@ChALkeR Now that you mentioned it, I am not sure if the change proposed in this PR would be fine. If someone is using .write(string, encoding, offset), control will go to the proposed else block and would end up giving unexpected result. Am I correct?

Loading

@ChALkeR
Copy link
Member

@ChALkeR ChALkeR commented Feb 4, 2016

@thefourtheye I think that we should add an explicit throw there, and leave the if-else branches as they are.

Loading

@thefourtheye
Copy link
Contributor

@thefourtheye thefourtheye commented Feb 4, 2016

Ya, that sounds better here. @mscdex also suggested the same. @trevnorris what do you think?

Loading

@dcposch
Copy link
Contributor Author

@dcposch dcposch commented Feb 4, 2016

@thefourtheye @ChALkeR @mscdex now throwing an exception -- looks better?

Loading

@thefourtheye
Copy link
Contributor

@thefourtheye thefourtheye commented Feb 4, 2016

LGTM, if CI and @trevnorris are okay with this.

Loading

encoding = offset;
offset = length >>> 0;
length = swap;
throw new Error('Buffer.write(string, encoding, offset[, length]) ' +
Copy link
Contributor

@trevnorris trevnorris Feb 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically should be ``Buffer.write(string, encoding[, offset[, length]])'`, but I really don't care whether it's changed.

Loading

Copy link
Member

@ChALkeR ChALkeR Feb 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string, encoding fits into the current signature, so it's not deprecated. I made that mistake in the first grep :-).

Loading

Copy link
Contributor

@trevnorris trevnorris Feb 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChALkeR Sorry, not following.

Loading

@trevnorris
Copy link
Contributor

@trevnorris trevnorris commented Feb 4, 2016

What's wrong with dropping the length === undefined on the second else if? Then technically the final else should be unreachable.

Loading

@dcposch
Copy link
Contributor Author

@dcposch dcposch commented Feb 4, 2016

@trevnorris because then if someone is still using the obsolete form, say buf.write("foo", "utf8", 10) it will silently start behaving like buf.write("foo", "utf8"). seems safer to throw an exception explaining what's wrong.

I can't see the CI because apparently it's on lockdown... LMK how it goes

Loading

@jasnell
Copy link
Member

@jasnell jasnell commented Feb 4, 2016

Loading

@mscdex
Copy link
Contributor

@mscdex mscdex commented Feb 4, 2016

LGTM

Loading

@trevnorris
Copy link
Contributor

@trevnorris trevnorris commented Feb 5, 2016

@dcposch I can buy that. Maybe just put a comment as to why we're throwing. Since in the normal case we'd just ignore any trailing arguments (only exception is the recent change to Buffer constructor, which now throws if encoding is passed with a number).

Loading

@dcposch
Copy link
Contributor Author

@dcposch dcposch commented Feb 5, 2016

Loading

@trevnorris
Copy link
Contributor

@trevnorris trevnorris commented Feb 5, 2016

@dcposch Thanks for that.

LGTM

Loading

jasnell added a commit that referenced this issue Feb 7, 2016
* Explit throw on deprecated Buffer.write(...)
* Update tests, remove obsolete Buffer.write(...)
* Add comment for obsolete Buffer.write(...)

PR-URL: #5048
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell
Copy link
Member

@jasnell jasnell commented Feb 7, 2016

Landed in 2c55cc2

Loading

@jasnell jasnell closed this Feb 7, 2016
@jasnell jasnell mentioned this pull request Mar 17, 2016
scovetta pushed a commit to scovetta/node that referenced this issue Apr 2, 2016
* Explit throw on deprecated Buffer.write(...)
* Update tests, remove obsolete Buffer.write(...)
* Add comment for obsolete Buffer.write(...)

PR-URL: nodejs#5048
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell jasnell mentioned this pull request Apr 19, 2016
jasnell added a commit that referenced this issue Apr 26, 2016
The following significant (semver-major) changes have been made since the
previous Node v5.0.0 release.

* Buffer
  * New Buffer constructors have been added
    [#4682](#4682)
  * Previously deprecated Buffer APIs are removed
    [#5048](#5048),
    [#4594](#4594)
  * Improved error handling [#4514](#4514)
* Cluster
  * Worker emitted as first argument in 'message' event
    [#5361](#5361).
* Crypto
  * Improved error handling [#3100](#3100),
    [#5611](#5611)
  * Simplified Certificate class bindings
    [#5382](#5382)
  * Improved control over FIPS mode
    [#5181](#5181)
  * pbkdf2 digest overloading is deprecated
    [#4047](#4047)
* Dependencies
  * Reintroduce shared c-ares build support
    [#5775](#5775).
  * V8 updated to 5.0.71.31 [#6111](#6111).
* DNS
  * Add resolvePtr API to query plain DNS PTR records
    [#4921](#4921).
* Domains
  * Clear stack when no error handler
  [#4659](#4659).
* File System
  * The `fs.realpath()` and `fs.realpathSync()` methods have been updated
    to use a more efficient libuv implementation. This change includes the
    removal of the `cache` argument and the method can throw new errors
    [#3594](#3594)
  * FS apis can now accept and return paths as Buffers
    [#5616](#5616).
  * Error handling and type checking improvements
    [#5616](#5616),
    [#5590](#5590),
    [#4518](#4518),
    [#3917](#3917).
  * fs.read's string interface is deprecated
    [#4525](#4525)
* HTTP
  * 'clientError' can now be used to return custom errors from an
    HTTP server [#4557](#4557).
* Modules
  * Current directory is now prioritized for local lookups
    [#5689](#5689)
  * Symbolic links are preserved when requiring modules
    [#5950](#5950)
* Net
  * DNS hints no longer implicitly set
    [#6021](#6021).
  * Improved error handling and type checking
    [#5981](#5981),
    [#5733](#5733),
    [#2904](#2904)
* Path
  * Improved type checking [#5348](#5348).
* Process
  * Introduce process warnings API
    [#4782](#4782).
  * Throw exception when non-function passed to nextTick
    [#3860](#3860).
* Readline
  * Emit key info unconditionally
    [#6024](#6024)
* REPL
  * Assignment to `_` will emit a warning.
    [#5535](#5535)
* Timers
  * Fail early when callback is not a function
    [#4362](#4362)
* TLS
  * Rename 'clientError' to 'tlsClientError'
    [#4557](#4557)
  * SHA1 used for sessionIdContext
    [#3866](#3866)
* TTY
  * Previously deprecated setRawMode wrapper is removed
    [#2528](#2528).
* Util
  * Changes to Error object formatting
    [#4582](#4582).
* Windows
  * Windows XP and Vista are no longer supported
    [#5167](#5167),
    [#5167](#5167).
jasnell added a commit that referenced this issue Apr 26, 2016
The following significant (semver-major) changes have been made since the
previous Node v5.0.0 release.

* Buffer
  * New Buffer constructors have been added
    [#4682](#4682)
  * Previously deprecated Buffer APIs are removed
    [#5048](#5048),
    [#4594](#4594)
  * Improved error handling [#4514](#4514)
* Cluster
  * Worker emitted as first argument in 'message' event
    [#5361](#5361).
* Crypto
  * Improved error handling [#3100](#3100),
    [#5611](#5611)
  * Simplified Certificate class bindings
    [#5382](#5382)
  * Improved control over FIPS mode
    [#5181](#5181)
  * pbkdf2 digest overloading is deprecated
    [#4047](#4047)
* Dependencies
  * Reintroduce shared c-ares build support
    [#5775](#5775).
  * V8 updated to 5.0.71.31 [#6111](#6111).
* DNS
  * Add resolvePtr API to query plain DNS PTR records
    [#4921](#4921).
* Domains
  * Clear stack when no error handler
  [#4659](#4659).
* File System
  * The `fs.realpath()` and `fs.realpathSync()` methods have been updated
    to use a more efficient libuv implementation. This change includes the
    removal of the `cache` argument and the method can throw new errors
    [#3594](#3594)
  * FS apis can now accept and return paths as Buffers
    [#5616](#5616).
  * Error handling and type checking improvements
    [#5616](#5616),
    [#5590](#5590),
    [#4518](#4518),
    [#3917](#3917).
  * fs.read's string interface is deprecated
    [#4525](#4525)
* HTTP
  * 'clientError' can now be used to return custom errors from an
    HTTP server [#4557](#4557).
* Modules
  * Current directory is now prioritized for local lookups
    [#5689](#5689)
  * Symbolic links are preserved when requiring modules
    [#5950](#5950)
* Net
  * DNS hints no longer implicitly set
    [#6021](#6021).
  * Improved error handling and type checking
    [#5981](#5981),
    [#5733](#5733),
    [#2904](#2904)
* Path
  * Improved type checking [#5348](#5348).
* Process
  * Introduce process warnings API
    [#4782](#4782).
  * Throw exception when non-function passed to nextTick
    [#3860](#3860).
* Readline
  * Emit key info unconditionally
    [#6024](#6024)
* REPL
  * Assignment to `_` will emit a warning.
    [#5535](#5535)
* Timers
  * Fail early when callback is not a function
    [#4362](#4362)
* TLS
  * Rename 'clientError' to 'tlsClientError'
    [#4557](#4557)
  * SHA1 used for sessionIdContext
    [#3866](#3866)
* TTY
  * Previously deprecated setRawMode wrapper is removed
    [#2528](#2528).
* Util
  * Changes to Error object formatting
    [#4582](#4582).
* Windows
  * Windows XP and Vista are no longer supported
    [#5167](#5167),
    [#5167](#5167).
jasnell added a commit that referenced this issue Apr 26, 2016
The following significant (semver-major) changes have been made since the
previous Node v5.0.0 release.

* Buffer
  * New Buffer constructors have been added
    [#4682](#4682)
  * Previously deprecated Buffer APIs are removed
    [#5048](#5048),
    [#4594](#4594)
  * Improved error handling [#4514](#4514)
* Cluster
  * Worker emitted as first argument in 'message' event
    [#5361](#5361).
* Crypto
  * Improved error handling [#3100](#3100),
    [#5611](#5611)
  * Simplified Certificate class bindings
    [#5382](#5382)
  * Improved control over FIPS mode
    [#5181](#5181)
  * pbkdf2 digest overloading is deprecated
    [#4047](#4047)
* Dependencies
  * Reintroduce shared c-ares build support
    [#5775](#5775).
  * V8 updated to 5.0.71.31 [#6111](#6111).
* DNS
  * Add resolvePtr API to query plain DNS PTR records
    [#4921](#4921).
* Domains
  * Clear stack when no error handler
  [#4659](#4659).
* File System
  * The `fs.realpath()` and `fs.realpathSync()` methods have been updated
    to use a more efficient libuv implementation. This change includes the
    removal of the `cache` argument and the method can throw new errors
    [#3594](#3594)
  * FS apis can now accept and return paths as Buffers
    [#5616](#5616).
  * Error handling and type checking improvements
    [#5616](#5616),
    [#5590](#5590),
    [#4518](#4518),
    [#3917](#3917).
  * fs.read's string interface is deprecated
    [#4525](#4525)
* HTTP
  * 'clientError' can now be used to return custom errors from an
    HTTP server [#4557](#4557).
* Modules
  * Current directory is now prioritized for local lookups
    [#5689](#5689)
  * Symbolic links are preserved when requiring modules
    [#5950](#5950)
* Net
  * DNS hints no longer implicitly set
    [#6021](#6021).
  * Improved error handling and type checking
    [#5981](#5981),
    [#5733](#5733),
    [#2904](#2904)
* OS X
  * MACOSX_DEPLOYMENT_TARGET has been bumped up to 10.7
    [#6402](#6402).
* Path
  * Improved type checking [#5348](#5348).
* Process
  * Introduce process warnings API
    [#4782](#4782).
  * Throw exception when non-function passed to nextTick
    [#3860](#3860).
* Readline
  * Emit key info unconditionally
    [#6024](#6024)
* REPL
  * Assignment to `_` will emit a warning.
    [#5535](#5535)
* Timers
  * Fail early when callback is not a function
    [#4362](#4362)
* TLS
  * Rename 'clientError' to 'tlsClientError'
    [#4557](#4557)
  * SHA1 used for sessionIdContext
    [#3866](#3866)
* TTY
  * Previously deprecated setRawMode wrapper is removed
    [#2528](#2528).
* Util
  * Changes to Error object formatting
    [#4582](#4582).
* Windows
  * Windows XP and Vista are no longer supported
    [#5167](#5167),
    [#5167](#5167).
jasnell added a commit that referenced this issue Apr 26, 2016
The following significant (semver-major) changes have been made since the
previous Node v5.0.0 release.

* Buffer
  * New Buffer constructors have been added
    [#4682](#4682)
  * Previously deprecated Buffer APIs are removed
    [#5048](#5048),
    [#4594](#4594)
  * Improved error handling [#4514](#4514)
* Cluster
  * Worker emitted as first argument in 'message' event
    [#5361](#5361).
* Crypto
  * Improved error handling [#3100](#3100),
    [#5611](#5611)
  * Simplified Certificate class bindings
    [#5382](#5382)
  * Improved control over FIPS mode
    [#5181](#5181)
  * pbkdf2 digest overloading is deprecated
    [#4047](#4047)
* Dependencies
  * Reintroduce shared c-ares build support
    [#5775](#5775).
  * V8 updated to 5.0.71.31 [#6111](#6111).
* DNS
  * Add resolvePtr API to query plain DNS PTR records
    [#4921](#4921).
* Domains
  * Clear stack when no error handler
  [#4659](#4659).
* File System
  * The `fs.realpath()` and `fs.realpathSync()` methods have been updated
    to use a more efficient libuv implementation. This change includes the
    removal of the `cache` argument and the method can throw new errors
    [#3594](#3594)
  * FS apis can now accept and return paths as Buffers
    [#5616](#5616).
  * Error handling and type checking improvements
    [#5616](#5616),
    [#5590](#5590),
    [#4518](#4518),
    [#3917](#3917).
  * fs.read's string interface is deprecated
    [#4525](#4525)
* HTTP
  * 'clientError' can now be used to return custom errors from an
    HTTP server [#4557](#4557).
* Modules
  * Current directory is now prioritized for local lookups
    [#5689](#5689)
  * Symbolic links are preserved when requiring modules
    [#5950](#5950)
* Net
  * DNS hints no longer implicitly set
    [#6021](#6021).
  * Improved error handling and type checking
    [#5981](#5981),
    [#5733](#5733),
    [#2904](#2904)
* OS X
  * MACOSX_DEPLOYMENT_TARGET has been bumped up to 10.7
    [#6402](#6402).
* Path
  * Improved type checking [#5348](#5348).
* Process
  * Introduce process warnings API
    [#4782](#4782).
  * Throw exception when non-function passed to nextTick
    [#3860](#3860).
* Readline
  * Emit key info unconditionally
    [#6024](#6024)
* REPL
  * Assignment to `_` will emit a warning.
    [#5535](#5535)
* Timers
  * Fail early when callback is not a function
    [#4362](#4362)
* TLS
  * Rename 'clientError' to 'tlsClientError'
    [#4557](#4557)
  * SHA1 used for sessionIdContext
    [#3866](#3866)
* TTY
  * Previously deprecated setRawMode wrapper is removed
    [#2528](#2528).
* Util
  * Changes to Error object formatting
    [#4582](#4582).
* Windows
  * Windows XP and Vista are no longer supported
    [#5167](#5167),
    [#5167](#5167).
jasnell added a commit that referenced this issue Apr 26, 2016
The following significant (semver-major) changes have been made since the
previous Node v5.0.0 release.

* Buffer
  * New Buffer constructors have been added
    [#4682](#4682)
  * Previously deprecated Buffer APIs are removed
    [#5048](#5048),
    [#4594](#4594)
  * Improved error handling [#4514](#4514)
* Cluster
  * Worker emitted as first argument in 'message' event
    [#5361](#5361).
* Crypto
  * Improved error handling [#3100](#3100),
    [#5611](#5611)
  * Simplified Certificate class bindings
    [#5382](#5382)
  * Improved control over FIPS mode
    [#5181](#5181)
  * pbkdf2 digest overloading is deprecated
    [#4047](#4047)
* Dependencies
  * Reintroduce shared c-ares build support
    [#5775](#5775).
  * V8 updated to 5.0.71.31 [#6111](#6111).
* DNS
  * Add resolvePtr API to query plain DNS PTR records
    [#4921](#4921).
* Domains
  * Clear stack when no error handler
  [#4659](#4659).
* File System
  * The `fs.realpath()` and `fs.realpathSync()` methods have been updated
    to use a more efficient libuv implementation. This change includes the
    removal of the `cache` argument and the method can throw new errors
    [#3594](#3594)
  * FS apis can now accept and return paths as Buffers
    [#5616](#5616).
  * Error handling and type checking improvements
    [#5616](#5616),
    [#5590](#5590),
    [#4518](#4518),
    [#3917](#3917).
  * fs.read's string interface is deprecated
    [#4525](#4525)
* HTTP
  * 'clientError' can now be used to return custom errors from an
    HTTP server [#4557](#4557).
* Modules
  * Current directory is now prioritized for local lookups
    [#5689](#5689)
  * Symbolic links are preserved when requiring modules
    [#5950](#5950)
* Net
  * DNS hints no longer implicitly set
    [#6021](#6021).
  * Improved error handling and type checking
    [#5981](#5981),
    [#5733](#5733),
    [#2904](#2904)
* OS X
  * MACOSX_DEPLOYMENT_TARGET has been bumped up to 10.7
    [#6402](#6402).
* Path
  * Improved type checking [#5348](#5348).
* Process
  * Introduce process warnings API
    [#4782](#4782).
  * Throw exception when non-function passed to nextTick
    [#3860](#3860).
* Readline
  * Emit key info unconditionally
    [#6024](#6024)
* REPL
  * Assignment to `_` will emit a warning.
    [#5535](#5535)
* Timers
  * Fail early when callback is not a function
    [#4362](#4362)
* TLS
  * Rename 'clientError' to 'tlsClientError'
    [#4557](#4557)
  * SHA1 used for sessionIdContext
    [#3866](#3866)
* TTY
  * Previously deprecated setRawMode wrapper is removed
    [#2528](#2528).
* Util
  * Changes to Error object formatting
    [#4582](#4582).
* Windows
  * Windows XP and Vista are no longer supported
    [#5167](#5167),
    [#5167](#5167).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

7 participants