Node.js v0.8 即將發布
Node.js是一套用來編寫高性能網絡服務器的JavaScript工具包,一系列的變化由此開始。比較獨特的是,Node.js會假設你是在POSIX環境下運行它Linux 或 Mac OS X。如果你是在Windows下,那就需要安裝MinGW以獲得一個仿POSIX的環境。在Node中,Http是首要的。Node為創建http服務器作了優化,所以你在網上看到的大部分示例和庫都是集中在web上(http框架、模板庫等)。
Node.js v0.8 版本指日可待了,0.7 版本再經過1個或者2個版本發布就轉為穩定版了。
NodeJS v0.6 和 Node.js v0.8 在 API 上有一些小變化。
廢棄:
http.Client()
path.{exists,existsSync}
was moved tofs.{exists,existsSync}
tty.setRawMode(mode)
was moved totty.ReadStream#setRawMode()
(i.e.process.stdin.setRawMode()
)
刪除:
waf
build system -node.js
will be usinggyp
now * If you are a native module author, migrate tonode-gyp
ASAP!sys
throws
改動:
-
process
*process.stdin.on('keypress')
will not be emitted by default, as it’s an internal API. -
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 do now kill them self when they accidentally losses there connection with 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.
</ul> </li>
-
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. </ul> </li>
-
readline
*arguments
ofrl.createInterface
became 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.timeEnd
now throws when there’s no such label
</ul>
-
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 graceful.
-
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.uniqueID
what there before was internally known asworkerID
.worker.suicide
flag set when worker disconnect or die, indicate if this was an accidental death.
</ul> </li>
-
crypto
crypto.getDiffieHellman()
.cipher.setAutoPadding()
anddecipher.setAutoPadding()
.ciphers
option tocrypto.createCredentials()
.
</ul> </li>
-
domain
* see http://nodejs.org/docs/v0.7.9/api/domain.html -
fs
fs.appendFile()
andfs.appendFileSync()
.wx
,wx+
,ax
, andax+
modes tofs.open()
andfs.openSync()
.
</ul> </li>
-
http
- callback optional argument to
server.close()
. sendDate
property tohttp.ServerResponse
.
</ul> </li>
-
https
*ciphers
,rejectUnauthorized
option tohttps.request()
andhttps.get()
. -
net
net.connect(options, [connectionListener)
.- callback optional argument to
server.close()
.
</ul> </li>
-
process
process.abort()
.process.hrtime()
, hi-res timer with up to nanosecond granularity.
</ul> </li>
-
querystring
*querystring.parse(str, [sep], [eq], [options])
. -
stream
*'utf16le'
and'ucs2'
encoding tosetEncoding()
. -
tls
tls.CLIENT_RENEG_LIMIT
andtls.CLIENT_RENEG_WINDOW
to mitigate session renegotiation attackstls.connect(options, [secureConnectionListener])
.ciphers
,rejectUnauthorized
andsocket
options totls.connect()
.cleartextStream.getCipher()
was added in the api doc and open to the public.
</ul> </li>
-
zlib
*dictionary
option.
</ul>
本文由用戶 openkk 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!
- callback optional argument to
添加: