GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Remove deprecated Buffer.write(...) by dcposch · Pull Request #5048 · nodejs/node

Conversation

@dcposch

@dcposch dcposch commented Feb 3, 2016

Copy link
Copy Markdown
Contributor

It said:

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

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

@mikeal

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dcposch
Remove deprecated code
3e7b69a
@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 Issues and PRs related to the buffer subsystem. label Feb 3, 2016
mscdex
mscdex reviewed Feb 3, 2016
View reviewed changes
Comment thread lib/buffer.js Outdated

@mscdex mscdex Feb 3, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@dcposch dcposch Feb 3, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@dcposch dcposch Feb 4, 2016

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@mscdex

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ChALkeR ChALkeR Feb 4, 2016

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jasnell

jasnell commented Feb 3, 2016

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rvagg

rvagg commented Feb 3, 2016

Copy link
Copy Markdown
Member

@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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@trevnorris

trevnorris commented Feb 4, 2016

Copy link
Copy Markdown
Contributor

@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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thefourtheye

thefourtheye commented Feb 4, 2016

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ChALkeR

ChALkeR commented Feb 4, 2016

Copy link
Copy Markdown
Member

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thefourtheye

thefourtheye commented Feb 4, 2016

Copy link
Copy Markdown
Contributor

@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*\)/?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ChALkeR

ChALkeR commented Feb 4, 2016

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ChALkeR

ChALkeR commented Feb 4, 2016

Copy link
Copy Markdown
Member

@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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thefourtheye

thefourtheye commented Feb 4, 2016

Copy link
Copy Markdown
Contributor

@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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ChALkeR

ChALkeR commented Feb 4, 2016

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thefourtheye

thefourtheye commented Feb 4, 2016

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ChALkeR ChALkeR added the semver-major PRs that contain breaking changes and should be released in the next major version. label Feb 4, 2016
@dcposch
Explit throw on deprecated Buffer.write(...)
2c53436
@dcposch

dcposch commented Feb 4, 2016

Copy link
Copy Markdown
Contributor Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dcposch
Update tests, remove obsolete Buffer.write(...)
6413181
@dcposch
dcposch force-pushed the deprecate branch from fe94447 to 6413181 Compare February 4, 2016 09:37
@thefourtheye

thefourtheye commented Feb 4, 2016

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

trevnorris
trevnorris reviewed Feb 4, 2016
View reviewed changes
Comment thread lib/buffer.js
encoding = offset;
offset = length >>> 0;
length = swap;
throw new Error('Buffer.write(string, encoding, offset[, length]) ' +

@trevnorris trevnorris Feb 4, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@ChALkeR ChALkeR Feb 4, 2016

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

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 :-).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@trevnorris trevnorris Feb 5, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@ChALkeR Sorry, not following.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@trevnorris

trevnorris commented Feb 4, 2016

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dcposch

dcposch commented Feb 4, 2016

Copy link
Copy Markdown
Contributor Author

@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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Feb 4, 2016

Copy link
Copy Markdown
Member

New CI: https://ci.nodejs.org/job/node-test-pull-request/1548/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mscdex

mscdex commented Feb 4, 2016

Copy link
Copy Markdown
Contributor

LGTM

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@trevnorris

trevnorris commented Feb 5, 2016

Copy link
Copy Markdown
Contributor

@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).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dcposch
Add comment for obsolete Buffer.write(...)
10abe60
@dcposch

dcposch commented Feb 5, 2016

Copy link
Copy Markdown
Contributor Author

@trevnorris done

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@trevnorris

trevnorris commented Feb 5, 2016

Copy link
Copy Markdown
Contributor

@dcposch Thanks for that.

LGTM

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell pushed a commit that referenced this pull request Feb 7, 2016
@dcposch @jasnell
buffer: remove deprecated Buffer.write branch
2c55cc2
* 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 <[email protected]>
Reviewed-By: Trevor Norris <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@jasnell

jasnell commented Feb 7, 2016

Copy link
Copy Markdown
Member

Landed in 2c55cc2

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell jasnell closed this Feb 7, 2016
@jasnell jasnell mentioned this pull request Mar 17, 2016
Planning for v6 #5766
Closed
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
@dcposch Michael Scovetta
buffer: remove deprecated Buffer.write branch
0ae7810
* 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 <[email protected]>
Reviewed-By: Trevor Norris <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@jasnell jasnell mentioned this pull request Apr 19, 2016
What is new in v6? #6264
Closed
jasnell added a commit that referenced this pull request Apr 26, 2016
@jasnell
2016-04-26, Version 6.0.0 (Current) Release
f5f573f
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 jasnell mentioned this pull request Apr 26, 2016
2016-04-26, Version 6.0.0 (Current) Release #6383
Closed
jasnell added a commit that referenced this pull request Apr 26, 2016
@jasnell
2016-04-26, Version 6.0.0 (Current) Release
c53d296
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 pull request Apr 26, 2016
@jasnell
2016-04-26, Version 6.0.0 (Current) Release
37f2f03
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 pull request Apr 26, 2016
@jasnell
2016-04-26, Version 6.0.0 (Current) Release
ce3e3c5
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 pull request Apr 26, 2016
@jasnell
2016-04-26, Version 6.0.0 (Current) Release
1a29a57
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).
@vitaly-t vitaly-t mentioned this pull request Apr 27, 2016
Doesn't work under Node.js 6.0.0 brianc/node-postgres#1000
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

buffer Issues and PRs related to the buffer subsystem. semver-major PRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@dcposch @jasnell @rvagg @trevnorris @thefourtheye @ChALkeR @mscdex
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.