-
Notifications
You must be signed in to change notification settings - Fork 24
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
length
optional third parameter was added toBuffer.write()
- The
-
child_process
- The
customFds
option to thechild_process.spawn()
method is deprecated. Only the values -1, 0, 1, 2 will work withcustomFds
now and only if those are TTY file descriptors. You can however use thestdinStream
,stdoutStream
, andstderrStream
options 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.lookup()
now usesgetaddrinfo()
in 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.lookup
on invalid domain names like"****"
the command returned anEBADNAME
error.getaddrinfo()
does not differentiate between invalid domains andENOTFOUND
(AKANXDOMAIN
). Thereforedns.lookup
now returnsENOTFOUND
when given malformated domain names like"*****"
.
-
-
events
- C++
node::EventEmitter
has been removed. Instead usenode::MakeCallback()
-
EventEmitter.removeAllListeners()
allows to remove all listeners at once.
- C++
-
fs
-
mode
argument offs.mkdir()
andfs.mkdirSync()
became an option (defaults to0777
). -
fs.symlink()
takes an optionalmode
argument, 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.watchFile()
is replaced byfs.watch()
-
-
http
-
http.request()
andhttp.get()
useConnection: Keep-Alive
by default. -
http.Agent.appendMessage()
was removed. -
http.getAgent()
was removed. Usehttp.globalAgent
instead. - Not
http.Agent
buthttp.ClientRequest
emits'upgrade'
event.
-
-
https
-
https.request()
andhttps.get()
with defaultAgent
ignorekey
,cert
andca
options. Use customAgent
.
-
-
Module system
- The
require.paths
have been removed (useNODE_PATH
environment variable instead).
- The
-
net
-
net.Server.listenFD()
was no longer supported.
-
-
process
-
process.ENV
was removed. Useprocess.env
instead. -
process.ARGV
was removed. Useprocess.argv
instead. -
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.memoryUsage().vsize
was removed. You don't need it. -
process.stdout
andprocess.stderr
are blocking when they refer to regular files or TTY file descriptors. -
process.stdin
,process.stdout
andprocess.stderr
are getters now. You can override it (if you really want to) like this:process.__defineGetter__('stdout', function() { return your_object; });
-
-
V8 (v3.1 to v3.6)
-
RegExp
was no longer aFunction
(compliant with ES5). UseRegExp.exec()
instead. -
Date
's string format without timezone (e.g.,new Date('2011-06-06')
) has been based on UTC, not local timezone (compliant with ES5). Use timezone explicitly (e.g.,new Date('2011-06-06 00:00:00 +09:00')
). - All standard properties of
Error
have been non-enumerable (compliant with ES5). useutil.inspect(err, true)
if you want to show it.
-
-
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_process
child_process.fork()
-
cluster
-
node cluster
see http://nodejs.org/docs/latest/api/cluster.html
-
-
crypto
-
crypto.createDiffieHellman()
,crypto.pbkdf2()
,crypto.randomBytes()
-
-
fs
-
fs.utimes()/utimesSync()
,fs.futimes()/futimesSync()
-
start
option tofs.createReadStream()
andfs.createWriteStream()
.
-
-
http
http.ClientRequest.setTimeout()/setNoDelay()/setSocketKeepAlive()
-
https
-
passphrase
option tohttps.createServer()
,https.request()
, andhttps.get()
.
-
- Module system
-
.json
module. module.require()
-
-
net
net.connect()
-
net.Socket.remotePort
,bytesRead
,bytesWrite
-
os
-
os.arch()
,os.platform()
,os.uptime()
,os.networkInterfaces()
-
-
path
path.relative()
-
process
-
process.arch
,process.uptime()
-
-
tls
-
passphrase
option totls.createServer()
andtls.connect()
. -
sessionIdContext
option totls.createServer()
. -
tls.CryptoStream.getSession()
andsession
option totls.connect()
. -
tls.CleartextStream.address()
,remoteAddress
,remotePort
. -
tls.Server
supports NPN (Next Protocol Negotitation) and SNI (Server Name Indication).
-
-
util
-
util.format()
,util.isArray()
,util.isRegExp()
,uitl.isDate()
,util.isError()
.
-
-
zlib
module http://nodejs.org/docs/latest/api/zlib.html