-
Notifications
You must be signed in to change notification settings - Fork 0
API changes between v0.4 and v0.6
When editing this page please be as detailed as possible. Examples are encouraged!
-
Cygwin build is no longer supported. Use native windows builds instead.
-
Buffer- The
lengthoptional third parameter was added toBuffer.write()
- The
-
child_process- The
customFdsoption to thechild_process.spawnmethod is deprecated. Only the values -1, 0, 1, 2 will work withcustomFdsnow and only if those are TTY file descriptors. You can however use thestdinStream,stdoutStream, andstderrStreamoptions to achieve similar functionality. - You can no longer send a file descriptor through a unix pipe. Instead you can send a handle via
child_process.fork.
- The
-
dgram- The
'unix_dgram'type to thedgram.createSocket()is no longer supported. The Unix domain datagram is not the Internet domain datagram (UDP) which stays supported.
- The
-
dns-
dns.lookupnow usesgetaddrinfoin a thread pool instead of c-ares. The rest of the methods in the DNS module still use c-ares. Using the system resolver for common look ups is useful because it hooks into system MDNS lookups and /etc/host files and nsswitch, etc. Previously when usingdns.lookupon invalid domain names like"****"the command returned anEBADNAMEerror.getaddrinfodoes not differentiate between invalid domains andENOTFOUND(AKANXDOMAIN). Thereforedns.lookupnow returnsENOTFOUNDwhen given malformated domain names like"*****".
-
-
events- C++
node::EventEmitterhas been removed. Instead usenode::MakeCallback() -
EventEmitter.removeAllListeners()allows to remove all listeners at once.
- C++
-
fs-
fs.symlinktakes an optionalmodeargument, which can either be 'dir' or 'file'. The default is 'file'. This argument is only needed for Windows (it's ignored on other platforms). -
fs.watchFileis replaced byfs.watch
-
-
http-
http.request()andhttp.get()useConnection: Keep-Aliveby default. -
http.Agent.appendMessagewas removed. -
http.getAgent()was removed. Usehttp.globalAgentinstead. - Not
httpAgentbuthttp.ClientRequestemits'upgrade'event.
-
-
https-
https.request()andhttps.get()with defaultAgentignorekey,certandcaoptions. Use customAgent.
-
-
Module system
- The
require.pathshave been removed (useNODE_PATHenvironment variable instead).
- The
-
net-
net.Server.listenFD()was no longer supported.
-
-
process-
process.ENVwas removed. Useprocess.envinstead. -
process.ARGVwas removed. Useprocess.argvinstead. -
process.binding('stdio')was removed. This was a private API. You shouldn't have been using it in the first place. -
process.binding('net')was removed. -
process.stdin,process.stdoutandprocess.stderrare getters now. You can override it (if you really want to) like this:process.__defineGetter__('stdout', function() { return your_object; });
-
process.memoryUsage().vsizewas removed. You don't need it.
-
-
Default Timezone changed. No longer adjusts for local timezone. Examples below are in the node repl in eastern timezone.
-
0.4.x:
new Date("2011-06-06") > Mon, 06 Jun 2011 04:00:00 GMT new Date("2011-06-06").getTime() > 1307332800000
-
0.5.10:
new Date("2011-06-06") > Mon, 06 Jun 2011 00:00:00 GMT new Date("2011-06-06").getTime() > 1307318400000
-
-
Error object has hidden properties. Examples below are in node repl. Notice the difference in the
enumerableproperty between the node versions.-
0.4.x:
var e = new Error() e > { stack: [Getter/Setter], arguments: undefined, type: undefined } Object.getOwnPropertyDescriptor(e, 'type') > { value: undefined, writable: true, enumerable: true, configurable: true }
-
-
0.5.10:
var e = new Error() e > [Error] Object.getOwnPropertyDescriptor(e, 'type') > { value: undefined, writable: true, enumerable: false, configurable: true }
-
V8 (v3.1 to v3.7)
-
RegExpwas no longer aFunction. UseRegExp.exec()instead.
-
-
assert-
assert(val)as a shorthand forassert.ok(val)
-
-
Buffer-
'hex'encoding. Buffer.readInt8()/readInt16LE()/readInt16BE()/readInt32LE()/readInt32BE()Buffer.readUInt8()/readUInt16LE()/readUInt16BE()/readUInt32LE()/readUInt32BE()Buffer.readFloatLE()/readFloatBE()/readDoubleLE()/readDoubleBE()Buffer.writeInt8()/writeInt16LE()/writeInt16BE()/writeInt32LE()/writeInt32BE()Buffer.writeUInt8()/writeUInt16LE()/writeUInt16BE()/writeUInt32LE()/writeUInt32BE()Buffer.writeFloatLE()/writeFloatBE()/writeDoubleLE()/writeDoubleBE()Buffer.fill()- Typed Arrays
-
-
child_processchild_process.fork()
-
cluster -
crypto-
crypto.createDiffieHellman(),crypto.pbkdf2(),crypto.randomBytes()
-
-
fs-
fs.utimes()/utimesSync(),fs.futimes()/futimesSync() -
startoption tofs.createReadStream()andfs.createWriteStream().
-
-
httphttp.ClientRequest.setTimeout()/setNoDelay()/setSocketKeepAlive()
- Module system
-
.jsonmodule. module.require()
-
-
netnet.connect()-
net.Socket.remotePort,bytesRead,bytesWrite
-
os-
os.arch(),os.platform(),os.uptime(),os.getNetworkInterfaces()
-
-
pathpath.relative()
-
process-
process.arch,process.uptime()
-
-
tls-
tls.CleartextStream.address(),remoteAddress,remotePort. -
tls.CryptoStream.getSession()andsessionoption totls.connect(). -
tls.Serversupports NPN (Next Protocol Negotitation) and SNI (Server Name Indication).
-
-
util-
util.format(),util.isArray(),util.isRegExp(),uitl.isDate(),util.isError().
-
-
zlibmodule http://nodejs.org/docs/latest/api/zlib.html