-
Notifications
You must be signed in to change notification settings - Fork 0
API changes between v0.10 and v0.12
When editing this page please be as detailed as possible. Examples are encouraged!
0.12.0 ships with V8 version 3.28.73, which was released in August 2014.
- On Unix soft
ulimitvalues are ignored.
-
Bufferclass has been removed and replaced with a namespace. Sousing node::Bufferwill no longer work. - All
node::Buffer::New()variants now returnLocal<Object>instead ofBuffer*. - The return value for
node::Buffer::New()is an instantiated JSBufferobject. -
node::Buffer::New(Handle<String>)now accepts an optional second argument ofenum encoding. - API addition of
node::Buffer::Use()which will use the passedchar*instead of making a copy. - API addition of
node::Crypto::Certificatewhich handlesnode::Crypto::Certificate::verifySpkac(Handle<String>),node::Crypto::Certificate::exportPublicKey(Handle<String>)&node::Crypto::Certificte::exportChallenge(Handle<String>)for working naively with SPKAC (Signed public key & challenges) coming from the HTML5keygenelement.
- External memory is now allocated using
smalloc, instead of usingSlowBufferas the parent backing. -
SlowBufferhas been repurposed to return aBufferinstance that has no parent backing. -
buffer.parentnow points to an object that has been allocated viasmalloc.alloc, not aBufferinstance, and only if the buffer is a slice. -
buffer.offsetis now a read-only prototype property equal to zero since no instance methods require working on the parent backing. - API additions
Buffer.alloc()andBuffer.dispose()have been added. -
Buffer#fill()has been extended to fill with the entire passed value. -
(new Buffer('text\0!', 'ascii')).toString()outputs'text !'in 0.10 and'text\u0000!'in 0.12. - Writable stream
_write()gets called with 'buffer' encoding when chunk is a Buffer (#6119). - Writable stream emits 'finish' on next tick if there was a
write()(#6118).
-
process.maxTickDepthhas been removed, allowingprocess.nextTickto starve I/O indefinitely. This is due to addingsetImmediatein 0.10.
-
customFdsoption tochild_process.spawnis deprecated. Instead ofcustomFdsyou can usestdiolike https://github.com/mochajs/mocha/pull/1364/files
-
SNICallbackrequired returning asecureContextsynchronously asfunction (hostname) {}. The function signature is nowfunction (hostname, cb) { cb(null, secureContext); }. You can feature detect with'function' === typeof cb.
In node 0.10.x, exit from a fatal signal was accomplished by a signal handler in
node which called exit(128 + signo). So for SIGINT (signal 2), a node process
observing the exit of a spawned node process would observe that process exiting 130,
but no signal would be noted (see waitid(2) for more information on how a process
waiting for another determines if the waitee exited due to a signal). In node
0.12.x, a node process observing the exit of a spawned child node process will
see a null code, and a 'SIGINT' as the signal.
Here is a pair of test programs which illustrates the difference.
$ cat sleeper.js
setTimeout(function () {}, 300000)
$ cat test.js
cp = require("child_process");
p = cp.spawn("node", ["sleeper.js"]);
report = function (code, signal) { console.log("code=" + code + ", signal=" + signal); }
p.on('exit', report);
setTimeout(function() { p.kill('SIGINT') }, 2000);
On node 0.10 this produces:
$ node test.js
code=130, signal=null
On node 0.12 this produces:
$ node test.js
code=null, signal=SIGINT
This can be a subtle porting issue for multi-process node environments which care
about signals (such as test harnesses). This change was introduced by
main: Handle SIGINT properly.
