-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Refs: nodejs/node#8169, nodejs/node#7152.
Two options here:
- Use the new Buffer API —
Buffer.alloc()/Buffer.from()/Buffer.allocUnsafe()(requires a shim for v0.10/v0.12 and older v4.x versions prior to v4.5.0). - Use
new Buffer()for the time being — just add thenewkeyword everywhere. You should manually check that everything is safe in this case, see the links below for more explanation. That might be hard-deprecated at some later point.
More background:
- https://github.com/ChALkeR/notes/blob/master/Lets-fix-Buffer-API.md
- https://github.com/ChALkeR/notes/blob/master/Buffer-knows-everything.md
- buffer: runtime-deprecate Buffer constructor nodejs/node#7152 (comment)
Quick grep (you should better re-check):
browserify-13.1.0.tgz/test/bare.js:34: ps.stdin.end('console.log(Buffer("ABC"))');
browserify-13.1.0.tgz/test/bare_shebang.js:32: ps.stdin.end('#!/usr/bin/env node\nconsole.log(Buffer("WOO"))');
browserify-13.1.0.tgz/test/global/buffer.js:1:t.equal(Buffer('xyz').toString('base64'), 'eHl6');
browserify-13.1.0.tgz/test/global/buffer.js:2:t.equal(Buffer('eHl6', 'base64').toString(), 'xyz');
browserify-13.1.0.tgz/test/leak.js:46: stream.push('t.equal(Buffer("eHl6", "base64").toString(), "xyz")');
The grep above only includes the lines that call Buffer() without the new keyword, if you choose to move to the new API — you should probably also replace new Buffer(…) calls.
dariocravero
Metadata
Metadata
Assignees
Labels
No labels