This repository has been archived by the owner on Oct 16, 2021. It is now read-only.
forked from nodejs/node-v0.x-archive
-
Notifications
You must be signed in to change notification settings - Fork 24
API changes between v0.6 and v0.8
OrangeDog edited this page Mar 4, 2013
·
64 revisions
When editing this page please be as detailed as possible. Examples are encouraged!
http.Client()
-
path.{exists,existsSync}
was moved tofs.{exists,existsSync}
-
tty.setRawMode(mode)
was moved totty.ReadStream#setRawMode()
(i.e.process.stdin.setRawMode()
) - Direct use of
ev_*
andeio_*
functions is deprecated. Please use the methods provided bylibuv
instead. For help porting fromeio_custom
touv_queue_work
, see this wiki page. For help porting fromev_io_*
touv_poll_*
, see this wiki page.
-
waf
build system -node.js
will be usinggyp
now- If you are a native module author(you may still be one if you're not on this list), migrate to
node-gyp
ASAP!
- If you are a native module author(you may still be one if you're not on this list), migrate to
-
require('sys')
throws, userequire('util')
now. The "sys" module was deprecated in node v0.4. -
process.installPrefix
has been removed (#3483).process.installPrefix
was (accidentally) alwaysundefined
in node v0.6. -
node --vars
has been removed (#3483).node --vars
always (accidentally) has empty output in node v0.6
-
process
-
process.stdin.on('keypress')
will not be emitted by default, as it's an internal API. Use thekeypress
module now. -
process.stdin.pipe(dest)
will automatically callprocess.stdin.resume()
.
-
-
cluster
-
cluster.fork()
no longer return achild_process.fork()
object usecluster.fork().process
to get the object. - the
'death'
event on thecluster
object is renamed to'exit'
. - the
kill()
method is renamed todestroy()
. - the
CLUSTER_WORKER_ID
env is now calledCLUSTER_UNIQUE_ID
, but you should not have used that anyway. - workers now kill themselves when they accidentally lose their connection to the master.
-
-
http
-
http.Server
emits'connect'
event instead of'upgrade'
when the CONNECT method is requested. -
http.ServerResponse
sendsDate:
header by default. You can disable it by settingresponse.sendDate
tofalse
. -
http.ClientRequest
emits'connect'
event instead of'request'
when the CONNECT method is responded.
-
-
net
-
net.listen(socketPath)
no longer unlinks the socket unless you callserver.close()
. Automatic unlinking was subject to race conditions in multi-process setups. Also applies tohttp.listen(socketPath)
.
-
-
child_process
-
arguments
andoptions
arguments ofchild_process.fork()
became an option. - the
'exit'
event is now emitted right after the child process exits. It no longer waits for all stdio pipes to be closed. - the
'close'
event was added that has is emitted after the child has exited and all the stdio pipes are closed.
-
-
readline
-
arguments
ofrl.createInterface
became an option asrl.createInterface(options)
but still took an old style asrl.createInterface(input, output, completer)
-
-
url
-
url.parse()
now parses IPv6 addresses. -
url.parse()
now escapes delimiters characters rather than truncating the input. -
url.format()
now escapes theauth
section, andurl.parse()
decodes it.
-
-
fs
-
path.exists()
andpath.existsSync()
has moved tofs.exists()
andfs.existsSync()
. -
fs.symlink
type
argument can now be'junction'
(for Windows only). -
fs.realpath
andfs.lstat
work the same on Windows as on Unix
-
-
console
-
console.timeEnd
now throws when there's no such label
-
-
buffer
-
SlowBuffer
now inherits fromBuffer
. So if you have a module that modifies the prototype, now you only need to alterBuffer.prototype
.
-
-
os
-
os.cpus().times
is now supported on Windows -
os.uptime
now displays the correct uptime if the system's current uptime is > 50 days on Windows
-
-
buffer
-
'utf16le'
encoding.
-
-
child_process
-
silent
option tochild_process.fork()
-stdout
andstderr
won't be shared with parent. -
.disconnect()
when usingchild_process.fork()
this will allow the child to die gracefully. -
stdio
option forchild_process.spawn()
- configuration of child's stdio (file descriptors). -
detached
option forchild_process.spawn()
- make the child a process group leader (see docs) -
child.send()
can now sendnet.Server
andnet.Socket
as second argument.
-
-
cluster
-
'fork'
,'online'
,'listening'
, and'setup'
events. -
Worker
object which is provided fromcluster.workers
(in the master) orcluster.worker
(in the worker). -
env
optional argument tocluster.fork()
. -
cluster.setupMaster()
andcluster.settings
. -
cluster.disconnect()
andworker.disconnect()
. -
worker.id
what there before was internally known asworkerID
. -
worker.suicide
flag set when worker disconnect or die, indicate if this was an accidental death.
-
-
crypto
-
crypto.getDiffieHellman()
. -
cipher.setAutoPadding()
anddecipher.setAutoPadding()
. -
ciphers
option tocrypto.createCredentials()
.
-
-
domain
-
fs
-
fs.appendFile()
andfs.appendFileSync()
. -
wx
,wx+
,ax
, andax+
modes tofs.open()
andfs.openSync()
.
-
-
http
- callback optional argument to
server.close()
. -
sendDate
property tohttp.ServerResponse
. -
http.request()
andhttp.get()
can accept as their argument a url that is parsed withurl.parse()
- callback optional argument to
-
https
-
ciphers
,rejectUnauthorized
option tohttps.request()
andhttps.get()
.
-
-
net
-
net.connect(options, [connectionListener])
. - callback optional argument to
server.close()
. -
server.listen({ fd: someNumber })
to listen on arbitrary file descriptors.
-
-
process
-
process.abort()
. -
process.hrtime()
, hi-res timer with up to nanosecond granularity.
-
-
querystring
-
querystring.parse(str, [sep], [eq], [options])
, limited to 1000 parameters by default.
-
-
stream
-
'utf16le'
and'ucs2'
encoding tosetEncoding()
.
-
-
tls
-
tls.CLIENT_RENEG_LIMIT
andtls.CLIENT_RENEG_WINDOW
to mitigate session renegotiation attacks -
tls.connect(options, [secureConnectionListener])
. -
ciphers
,rejectUnauthorized
andsocket
options totls.connect()
. -
cleartextStream.getCipher()
was added in the api doc and open to the public.
-
-
zlib
-
dictionary
option.
-