-
Notifications
You must be signed in to change notification settings - Fork 0
API changes between v0.10 and v4
[Docs]
-
assert.deepEqual()
no longer checks forprototype
equality.-
assert.deepStrictEqual()
was introduced to deal with some former expectations aboutdeepEqual()
which were not true. - Refs:
e7573f9
,3f473ef
-
[Docs]
- External memory is now allocated using TypedArrays, instead of using
SlowBuffer
orsmalloc
as the parent backing.- Refs:
63da0df
- Refs:
-
Buffer.concat()
now always creates a new buffer, even if only called with one element. Previously when called with one element it would just return the element, even if not a Buffer. -
SlowBuffer
has been repurposed to return aBuffer
instance who's parent backing is not pooled.- Refs:
456942a
- Refs:
-
Buffer.prototype.toJSON()
's output is no longer the same as an array. Instead it is an object specifically tagged as a buffer, which can be recovered by passing it to (a new overload of) theBuffer
constructor.- Refs:
840a29f
- Refs:
-
Buffer.prototype.parent
is now a getter that points tobuffer.buffer
if the buffer's size is greater than zero.- Refs:
63da0df
- Refs:
-
Buffer.prototype.offset
is now a read-only getter that returnsbuffer.byteOffset
.- Refs:
63da0df
- Refs:
-
Buffer.prototype.fill()
now accepts multi-character strings and will fill with the entire passed value. Additionally,fill()
now returns itsbuffer
and can be chained.- Refs:
57ed3da
- Refs:
-
Buffer.prototype._charsWritten
no longer is written to, nor exists.- Refs:
ccda6bb
- Refs:
Implementation changes in V8 have caused subtle impacts how buffers work with encodings in certain cases.
-
(new Buffer('text\0!', 'ascii')).toString()
outputs'text !'
in 0.10 and'text\u0000!'
in 0.12. - Invalid unicode characters are replaced to no longer become invalid.
- Refs: #2344
[Docs]
-
ChildProcess.prototype.send()
is now always asynchronous, where previously it was blocking on Unix. - The
customFds
option forChildProcess.prototype.spawn()
is deprecated. Instead ofcustomFds
you can use thestdio
option like this example.- Refs:
2454695
- Refs:
- The
'disconnect'
event on aChildProcess
is now fired asynchronously.- Refs:
b255f4c
- Refs:
[Docs]
- Cluster now uses round-robin load balancing by default on non-Windows platforms. The scheduling policy is configurable by setting
cluster.schedulingPolicy
.- It is advised that you do not use round-robin balancing on Windows as it is very inefficient.
- Refs:
e72cd41
- Cluster has been made
--debug
-aware. - Cluster's
'setup'
event now fires asynchronously.- Refs:
876d3bd
- Refs:
- Open connections (and other handles) in the master process are now closed when the last worker that holds a reference to them quits. Previously, they were only closed at cluster shutdown.
[Docs]
-
crypto.randomBytes()
now blocks if there is insufficient entropy.- Although it blocks, it should normally never take longer than a few milliseconds.
-
crypto.pseudoRandomBytes()
is now an alias tocrypto.randomBytes()
. - Refs:
e5e5980
-
crypto.Sign.prototype.sign()
will no longer swallow internal OpenSSL errors.- Refs:
00bffa6
- Refs:
[Docs]
-
dgram.Socket.prototype.send()
error semantics have changed.- Through 2.x, the the dgram
socket.send()
method emitted errors when a DNS lookup failed, even when a callback was provided. Starting from 3.0.0, if a callback is provided, no error event will be emitted. - When
send()
is supplied with a callback, it will no longer emit the'error'
event when an error occurs and instead pass the error to the callback. - Previously the behavior was to do both.
- Refs: #1796
- Through 2.x, the the dgram
[Docs]
The domain module has been scheduled for deprecation, awaiting an alternative for those who absolutely need domains.
It is suggested you avoid using domains if possible and rather rely on regular error checking.
-
domain.dispose()
has been deprecated.- Please recover from failed IO actions explicitly via error event handlers set on the domain.
- Refs:
d86814a
[Docs]
-
EventEmitter.listenerCount()
is now deprecated in favor ofEventEmitter.prototype.listenerCount()
.- Refs:
8f58fb9
- Refs:
- The
freelist
module was only ever intended for internal use and is now deprecated.
[Docs]
-
fs.createReadStream()
andfs.createWriteStream()
now have stricter type-checking for theoptions
argument.- Refs:
353e26e
- Refs:
-
fs.exists()
is now deprecated. It is suggested to use eitherfs.access()
orfs.stat()
. Please read the documentation carefully. - Added more informative errors and method call site details when the
NODE_DEBUG
environment is set to ease debugging.- The same thing applies to the synchronous versions of these APIs.
- Refs:
1f76a2e
- Fixed missing callbacks errors just being printed instead of thrown.
- Refs: Probably
1f40b2a
- Refs: Probably
- On Unix soft
ulimit
values are ignored. - Errors for async
fs
operations are now thrown if a callback is not present. - The error messages of most
fs
errors have been improved to be more descriptive and useful.- Refs:
bc2c85c
- Refs:
[Docs]
- http server timing change (Use
'finish'
instead of'prefinish'
when ending a response) - When doing HTTP pipelining of requests, the server creates new request and response objects for each incoming HTTP request on the socket. Starting from 3.0.0, these objects are now created a couple of ticks later, when we are certainly done processing the previous request. This could change the observable timing with certain HTTP server coding patterns.
- The switch to
'finish'
is intended to prevent the socket being detached from the response until after the data is actually sent to the other side. - Refs:
6020d2
, #1411 - Removed default chunked encoding on
DELETE
andOPTIONS
requests. -
http.STATUS_CODES
now maps to the regulated IANA standard set of codes. -
http.Agent.prototype.getName()
no longer returns an extra trailing colon. -
http.OutgoingMessage.prototype.flush()
has been deprecated in favor of the newflushHeaders()
method. The behavior remains the same.- Note: these methods reside on both the common http
request
andresponse
objects. - Refs:
b2e00e3
,nodejs/node@89f3c90
- Note: these methods reside on both the common http
-
http.OutgoingMessage.prototype.setHeader()
will now throw an error if the second argument is undefined.- Refs:
979d0ca
- Refs:
-
http.OutgoingMessage.prototype.write()
will now emit an error on theOutgoingMessage
(response
) object if it has been called afterend()
.- Refs:
64d6de9
- Refs:
-
http.request()
andhttp.get()
wrongly decode multi-byte string characters as'binary'
.- Notes: This bug still exists in 4.0.0.
- Refs: #2114, nodejs/node-v0.x-archive#25634 (comment)
-
http.request()
andhttp.get()
now throw a TypeError if the requested path contains illegal characters. (Currently only' '
).- Refs:
7124387
- Refs:
-
http.request()
andhttp.get()
no longer accept non-ascii characters in the header fields or path.
[Docs]
-
net.Server.prototype.address()
now also returns a{ address: '/path/to/socket' }
object, like it does for TCP and UDP sockets.- Previously it returned
socket._pipeName
directly for unix sockets. - Refs:
f337595
- Previously it returned
-
net.Server.prototype.listen()
will now try to bind to::
(IPv6) if the bind address is omitted, and use0.0.0.0
(IPv4) as a fallback.- Refs:
2272052
- Refs:
[Docs]
-
os.tmpdir()
now never returns a trailing slash regardless of the host platform. -
os.tmpdir()
on Windows now uses the%SystemRoot%
or%WINDIR%
environment variables instead of the hard-coded value ofc:\windows
when determining the temporary directory location.- Refs:
120e5a2
- Refs:
[Docs]
-
path.isAbsolute()
will now always return a boolean, even on windows.- Refs:
20229d6
- Refs:
- Many
path
functions now assert that any paths provided are strings.
[Docs]
- Added the concept of
beforeExit
time.- Before the process emits
'exit'
and begins shutting down, it will emit a'beforeExit'
event. Code that is run in the'beforeExit'
event can schedule async operations that will hold the event loop open, unlike'exit'
where it is too late to async operations. - Refs:
a2eeb43
- Before the process emits
- Chunked writes to sdtout/stderr will now be lost if the process is terminated early.
-
process.kill()
now throws errors on non-numeric input. -
process.maxTickDepth
has been removed, allowingprocess.nextTick()
to starve I/O indefinitely.- This is due to adding
setImmediate()
in 0.10. - It is suggested you use
setImmediate()
overprocess.nextTick()
.setImmediate()
likely does what you are hoping for (a more efficientsetTimeout(..., 0)
), and runs after this tick's I/O.process.nextTick()
does not actually run in the "next" tick anymore and will block I/O as if it were a synchronous operation. - Refs:
0761c90
,9a6c085
- This is due to adding
-
process.send()
is now always asynchronous, where previously it was blocking on Unix.
In node 0.10.x, exit from a fatal signal was accomplished by a signal handler in
node which called exit(128 + signo)
. So for SIGINT
(signal 2), a node process
observing the exit of a spawned node process would observe that process exiting 130,
but no signal would be noted (see waitid(2)
for more information on how a process
waiting for another determines if the waitee exited due to a signal). In node
0.12.x, a node process observing the exit of a spawned child node process will
see a null code
, and a 'SIGINT'
as the signal.
Here is a pair of test programs which illustrates the difference.
$ cat sleeper.js
setTimeout(function () {}, 300000)
$ cat test.js
var cp = require("child_process")
var p = cp.spawn("node", ["sleeper.js"])
p.on('exit', function (code, signal) {
console.log("code=" + code + ", signal=" + signal)
})
setTimeout(function () { p.kill('SIGINT') }, 2000)
On node 0.10 this produces:
$ node test.js
code=130, signal=null
On node 0.12+ this produces:
$ node test.js
code=null, signal=SIGINT
This can be a subtle porting issue for multi-process node environments which care
about signals (such as test harnesses). This change was introduced by
c61b0e9
—main: Handle SIGINT properly
.
[Docs]
- querystring's
stringifyPrimitive()
now stringifies numbers correctly.- Refs:
c9aec2b
- Refs:
-
querystring.stringify()
no longer accepts a 4th, undocumented,name
parameter.- Refs:
8d3bc88
- Refs:
smalloc
was a core module in 0.12 and io.js <3.0.0 for doing (external) raw memory allocation/deallocation/copying in JavaScript.
smalloc
was removed in io.js 3.0.0, as the required v8 APIs were removed. smalloc
used to be used in the buffer implementation, however buffers are now built on top of TypedArrays (Specifically Uint8Array).
[Docs]
The changes to streams are not as drastic as the transition from streams1 to streams2: they are a refinement of existing ideas, and should make the API slightly less surprising for humans and faster for computers. As a whole the changes are referred to as "streams3", but the changes should largely go unnoticed by the majority of stream consumers and implementers.
The distinction between "flowing" and "non-flowing" modes has been refined. Entering "flowing" mode is
no longer an irreversible operation -- it is possible to return to "non-flowing" mode from "flowing" mode.
Additionally, the two modes now flow through the same machinery instead of replacing methods. Any time
data is returned as a result of a .read()
call that data will also be emitted on the 'data'
event.
As before, adding a listener for the 'readable'
or 'data'
event will start flowing the stream; as
will piping to another stream.
The ability to "bulk write" to underlying resources has been added to Writable
streams. For stream
implementers, one can signal that a stream is bulk-writable by specifying a _writev method.
Bulk writes will occur in two situations:
- When a bulk-writable stream is clearing its backlog of buffered write requests,
- or if an end user has made use of the new
.cork()
and.uncork()
API methods.
.cork
and .uncork
allow the end user to control the buffering behavior of writable streams separate
from exerting backpressure. .cork()
indicates that the stream should accept new writes (up to .highWaterMark
),
while .uncork()
resets that behavior and attempts to bulk-write all buffered writes to the underlying resource.
The only core stream API that currently implements _writev()
is net.Socket
.
In addition to the bulk-write changes, the performance of repeated small writes to non-bulk-writable streams
(such as fs.WriteStream
) has been drastically improved. Users piping high volume log streams to disk should
see an improvement.
For a detailed overview of how streams3 interact, see this diagram.
-
WritableState.prototype.buffer
has been deprecated in favor of_writableState.getBuffer()
, which builds an array from an internal object single-way linked list.- Mutating the array returned will have no effect as
getBuffer()
constructs it from the linked list. However modifying one of the array's element's.next
property will effect the list. - Refs:
9158666
- Mutating the array returned will have no effect as
-
WritableStream.prototype._write()
now gets called with'buffer'
encoding when chunk is aBuffer
. - Writable streams now emit
'finish'
on the next tick if there was awrite()
when finishing.
- When in
objectMode
,Transform.prototype._read()
now processes false-y (but notnull
) values, such as''
,0
, etc.- Refs:
26ca7d7
- Refs:
As of 1.0.0 the sys
module is deprecated. It is advised to use the util
module instead.
[Docs]
- Updated
setImmediate()
to process the full queue each turn of the event loop, instead of one per queue.- It is suggested you use
setImmediate()
overprocess.nextTick()
.setImmediate()
likely does what you are hoping for (a more efficientsetTimeout(..., 0)
), and runs after this tick's I/O.process.nextTick()
does not actually run in the "next" tick anymore and will block I/O as if it were a synchronous operation. - Refs:
fa46483
- It is suggested you use
-
setImmediate()
's timing was adjusted slightly, but is still afterprocess.nextTick()
and I/O, but before regular timeouts and intervals.- Refs:
cd37251
- Refs:
- Internal timeouts now run in a separate queue with slightly different semantics, and will never keep the process alive on their own.
- This may effect your performance profile.
- It is strongly advised you do not attempt to use
_unrefActive()
as it will probably be hidden in the future. - Refs:
f46ad01
- Timer globals (e.g.
setTimeout()
) are no longer lazy-loaded.- Refs:
2903410
- Refs:
[Doc]
- The tls server option
SNICallback
required returning asecureContext
synchronously asfunction (hostname) { return secureContext; }
. The function signature is now asynchronous asfunction (hostname, cb) { cb(null, secureContext); }
. You can feature detect with'function' === typeof cb
.- Refs:
048e0e7
- Refs:
- The tls server option
dhparam
must now have a key length greater than 1024 bits, or else it will throw an error.- This is effectively a security fix. Please see https://weakdh.org/ for more information.
- Refs:
9b35be5
- RC4 is now disabled on the cipher list.
- RC4 is now considered insecure and has been removed from the list of default ciphers for TLS servers. Use the
ciphers
option when starting a new TLS server to supply an alternative list. - Refs: #826
- Potentially mitigated if archive#39 is merged.
- RC4 is now considered insecure and has been removed from the list of default ciphers for TLS servers. Use the
- Implemented TLS streams in C++, boosting their performance.
- Refs:
1738c77
- Refs:
- Moved & renamed
crypto.createCredentials()
totls.createSecureContext()
.- Refs:
5d2aef1
- Refs:
- Removed SSLv2 and SSLv3 support.
- Both SSLv2 and SSLv3 are now considered too insecure for general use and have been disabled at compile-time.
- Refs: #290, #315, archive#20
[Docs]
-
url.parse()
will now always return a query object and search string, even if they are empty, whenparseQueryString
(the second argument) is set totrue
.- e.g. a
url.parse(..., true)
return value will now include{ search: '', query: {} }
where previously both properties would not exist. - Refs:
b705b73
- e.g. a
-
url.parse()
now escapes the following characters and spaces (' '
) in the parsed object's properties:< > " ` \r \n \t { } | \ ^ '
- e.g.
url.parse("http://example.com/{z}/{x}/{y}.png#foo{}").href === 'http://example.com/%7Bz%7D/%7Bx%7D/%7By%7D.png#foo%7B%7D'
-
url.resolve()
now resolves properly to'.'
and'..'
.
[Docs]
-
util.is*()
(isArray()
...isUndefined()
) type-checking functions were added in 0.12 but are scheduled for deprecation. Please use user-land solutions instead.- The type checking these use will be come brittle with the eventual addition of
Symbol.toStringTag
. - Refs: #2447
- The type checking these use will be come brittle with the eventual addition of
- Updated
util.format()
to receive several changes:-
-0
is now displayed as such, instead of as0
.- Refs:
b3e4fc6
- Refs:
- Anything that is
instanceof Error
is now formatted as an error.- Refs:
684dd28
- Refs:
- Circular references in JavaScript objects are now handled for the
%j
specifier.- Refs:
2cd7adc
- Refs:
- Custom
inspect
functions now receive any arguments passed toutil.inspect
.- Refs:
07774e6
- Refs:
- Displays the constructor name if available.
- Refs:
7d14dd9
- Refs:
-
- The following utilities were deprecated in
896b2aa
:-
util.p()
,util.debug()
,util.error()
— Useconsole.error()
instead. -
util.print()
,util.puts()
— Useconsole.log()
instead. -
util.exec()
— Now found atchild_process.exec()
. -
util.pump()
— UseReadableStream.prototype.pipe()
instead.
-
[Docs]
- The
vm
module has been rewritten to work better, based on the excellent Contextify native module. All of the functionality of Contextify is now in core, with improvements!- Refs:
7afdba6
- Refs:
- Updated
vm.createContext(sandbox)
to "contextify" the sandbox, making it suitable for use as a global forvm
scripts, and then return it. It no longer creates a separate context object.- Refs:
7afdba6
- Refs:
- Updated most
vm
andvm.Script
methods to accept anoptions
object, allowing you to configure a timeout for the script, the error display behavior, and sometimes the filename (for stack traces).- Refs:
fd36576
- Refs:
- Updated the supplied sandbox object to be used directly as the global, remove error-prone copying of properties back and forth between the supplied sandbox object and the global that appears inside the scripts run by the
vm
module.- Refs:
7afdba6
- Refs:
For more information, see the vm
documentation linked above.
-
array.values()
came from an unofficial release of V8 and has since been removed pending further work on V8's conformance with the spec. Instead of continuing to float a patch on top of V8, io.js and the converged repository are currently without support for it.- Convergence discussion: archive#52
- Unknown command-line options are now errors.
- Refs:
185c515
- Refs:
- The built-in mdb_v8 bindings have been removed due to a lack of maintenance.
- Building node now has the following compiler version minimum requirements due to the newer v8 versions:
- g++ 4.8 & gcc 4.2 OR clang++ 3.4 & clang 3.2
- Refs:
48774ec
[Repo]
1.9.0-DEV -->
bagder/c-ares#bba4dc5
+ 7e1c0e7...08d0866
This is roughly c-ares version 1.10.1. At this point the Node.js team effectively "maintains" c-ares.
[Repo]
New in 0080788
, added to test c++ code. Only used in node's tests. Not exposed.
[Repo]
[Repo]
[Repo]
Note that npm minor and patch versions are pulled into io.js and node at an almost-weekly rate.
Also, the version of npm that ships with node.js v4.0.0+ has had it's node-gyp
dependency patched in a couple ways. node-gyp
is used to compile native add-ons.
- Enabled the windows delay-load hook by default.
3bda6cb
- A rare few native modules will not work with this on by default unless they are updated to fix the issues.
- More info about the delay-load hook can be found at
efadffe
.
- Downloads the new headers-only tarballs introduced in io.js.
e52f963
- Instead of downloading full tarballs of node.js, we now download tarballs of only the headers, which are much smaller. Full tarballs are still available for nodejs.org.
- Nightly and pre-release versions of node.js are able to download tarballs.
902c9ca
&9f727f5
[Repo]
[Repo]
[Repo]
1.2.3 --> 1.2.8
+ 59ad4b0...a80b977
v3.14.5.9 --> v4.5.x
+ floating patches
The version bump is contains about 21 stable (n.X) V8 releases.
Virtually all native addons must be updated to work with 4.0.0 from 0.10 or 0.12. Please see NAN's API docs for help with migrating your native addons.