Joyent Cloud just announced: Node.js v0.8 is around the corner. There’s only 1, maybe 2 more 0.7 nodejs releases, and then we’re going stable.
Here are all small API changes between NodeJS v0.6 and Node.js v0.8, give a try and update your npm modules!
Deprecated:
http.Client()path.{exists,existsSync}was moved tofs.{exists,existsSync}tty.setRawMode(mode)was moved totty.ReadStream#setRawMode()(i.e.process.stdin.setRawMode())
Removed:
wafbuild system -node.jswill be usinggypnow * If you are a native module author, migrate tonode-gypASAP!systhrows
Changed:
-
process*process.stdin.on('keypress')will not be emitted by default, as it’s an internal API. -
clustercluster.fork()no longer return achild_process.fork()object usecluster.fork().processto get the object.- the
'death'event on theclusterobject is renamed to'exit'. - the
kill()method is renamed todestroy(). - the
CLUSTER_WORKER_IDenv is now calledCLUSTER_UNIQUE_ID, but you should not have used that anyway. - workers do now kill them self when they accidentally losses there connection with the master.
-
httphttp.Serveremits'connect'event instead of'upgrade'when the CONNECT method is requested.http.ServerResponsesendsDate:header by default. You can disable it by settingresponse.sendDatetofalse.http.ClientRequestemits'connect'event instead of'request'when the CONNECT method is responded.
-
child_processargumentsandoptionsarguments 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*argumentsofrl.createInterfacebecame an option asrl.createInterface(options)but still took an old style as rl.createInterface(input, output, completer) -
url*url.parse()now parses IPv6 addresses. -
fs*path.exists()andpath.existsSync()has moved tofs.exists()andfs.existsSync(). -
console*console.timeEndnow throws when there’s no such label
Added:
-
buffer*'utf16le'encoding. -
child_processsilentoption tochild_process.fork()-stdoutandstderrwon’t be shared with parent..disconnect()when usingchild_process.fork()this will allow the child to die graceful.
-
cluster'fork','online','listening', and'setup'events.Workerobject which is provided fromcluster.workers(in the master) orcluster.worker(in the worker).envoptional argument tocluster.fork().cluster.setupMaster()andcluster.settings.cluster.disconnect()andworker.disconnect().worker.uniqueIDwhat there before was internally known asworkerID.worker.suicideflag set when worker disconnect or die, indicate if this was an accidental death.
-
cryptocrypto.getDiffieHellman().cipher.setAutoPadding()anddecipher.setAutoPadding().ciphersoption tocrypto.createCredentials().
-
domain* see http://nodejs.org/docs/v0.7.9/api/domain.html -
fsfs.appendFile()andfs.appendFileSync().wx,wx+,ax, andax+modes tofs.open()andfs.openSync().
-
http- callback optional argument to
server.close(). sendDateproperty tohttp.ServerResponse.
- callback optional argument to
-
https*ciphers,rejectUnauthorizedoption tohttps.request()andhttps.get(). -
netnet.connect(options, [connectionListener).- callback optional argument to
server.close().
-
processprocess.abort().process.hrtime(), hi-res timer with up to nanosecond granularity.
-
querystring*querystring.parse(str, [sep], [eq], [options]). -
stream*'utf16le'and'ucs2'encoding tosetEncoding(). -
tlstls.CLIENT_RENEG_LIMITandtls.CLIENT_RENEG_WINDOWto mitigate session renegotiation attackstls.connect(options, [secureConnectionListener]).ciphers,rejectUnauthorizedandsocketoptions totls.connect().cleartextStream.getCipher()was added in the api doc and open to the public.
-
zlib*dictionaryoption.