forked from nodejs/node-v0.x-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Api changes between v0.8 and v0.10
TooTallNate edited this page Feb 13, 2013
·
21 revisions
When editing this page please be as detailed as possible. Examples are encouraged!
-
Streams Interface
- Readable, Writable, Duplex, and Transform base classes added.
- Readable streams use a
read()method instead of emitting'data'events right away. - Adding a
'data'event handler, or callingpause()orresume()will switch into "old mode".- This means that
dataevent handlers won't ever miss the first chunk if they're not added right away, andpause()is no longer merely advisory.
- This means that
- If you don't consume the data, then streams will sit in a paused state forever, and the
endevent will never happen.
- The
uv_after_work_cbsignature has changed to take a second integer argument indicating status. For backwards compatibility, explicitly cast the 4th argument touv_queue_work. Example -
process.nextTickhappens at the end of the current tick, immediately after the current stack unwinds. If you are currently using recursive nextTick calls, usesetImmediateinstead. -
-p --printcommand line switch implies-e --eval - url: Parsed objects always have all properties, but unused ones are set to
null. Example:
// v0.8
> url.parse('http://foo')
{ protocol: 'http:',
slashes: true,
host: 'foo',
hostname: 'foo',
href: 'http://foo/',
pathname: '/',
path: '/' }
// 0.10
> url.parse('http://foo')
{ protocol: 'http:',
slashes: true,
auth: null,
host: 'foo',
port: null,
hostname: 'foo',
hash: null,
search: null,
query: null,
pathname: '/',
path: '/',
href: 'http://foo/' }- Domain-added properties on error objects are
camelCaseinstead ofsnake_case
- Streams - Added base classes for Readable, Writable, Duplex, and Transform
- Streaming interfaces for Crypto API
- process: add getgroups(), setgroups(), initgroups()
- crypto: getHashes() getCiphers()
- http: add response.headersSent property
- events: 'removeListener' event
- setImmediate() and clearImmediate() functions
- string_decoder: the decoder.end() function was added