Michaël Zasso
7e5bf80fd1
lib: enforce use of Promise from primordials
...
PR-URL: https://github.com/nodejs/node/pull/30936
Refs: https://github.com/nodejs/node/issues/30697
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2019-12-16 08:40:14 +01:00
Rongjian Zhang
0e3d774ed2
fs: fix existsSync for invalid symlink at win32
...
Fixes: https://github.com/nodejs/node/issues/30538
PR-URL: https://github.com/nodejs/node/pull/30556
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-12-03 23:48:08 +01:00
Michaël Zasso
1f9a5ae7aa
lib: use static Number properties from primordials
...
PR-URL: https://github.com/nodejs/node/pull/30686
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-11-30 13:45:38 +01:00
Michaël Zasso
0646eda4fc
lib: flatten access to primordials
...
Store all primordials as properties of the primordials object.
Static functions are prefixed by the constructor's name and prototype
methods are prefixed by the constructor's name followed by "Prototype".
For example: primordials.Object.keys becomes primordials.ObjectKeys.
PR-URL: https://github.com/nodejs/node/pull/30610
Refs: https://github.com/nodejs/node/issues/29766
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-11-25 10:28:15 +01:00
Lucas Holmquist
535e9571f5
fs: make FSStatWatcher.start private
...
An instance of FSStatWatcher is returned when a user calls fs.watchFile,
which will call the start method. A user can't create an instance
of a FSStatWatcher directly. If the start method is called by a user
it is a noop since the watcher has already started.
This "Class" is currently undocumented.
PR-URL: https://github.com/nodejs/node/pull/29971
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-11-19 16:05:21 +01:00
Nadya
dde8fd3fab
fs: change var to let
...
PR-URL: https://github.com/nodejs/node/pull/30318
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2019-11-08 15:31:05 -08:00
Lucas Holmquist
7eacb74389
fs: make FSWatcher.start private
...
* This is a semver-major change to rename the FSWatcher.start
function to FSWatcher._start to make it private
The motivation here is that it serves no purpose to the end user.
An instance of FSWatcher is returned when a user calls fs.watch,
which will call the start method. A user can't create an instance
of a FSWatcher directly. If the start method is called by a user
it is a noop since the watcher has already started. Calling start
after a watcher has closed is also a noop
PR-URL: https://github.com/nodejs/node/pull/29905
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-10-12 19:56:07 -07:00
Anna Henningsen
0ff4a558af
http2: allow passing FileHandle to respondWithFD
...
This seems to make sense if we want to promote the use
of `fs.promises`, although it’s not strictly necessary.
PR-URL: https://github.com/nodejs/node/pull/29876
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-10-09 23:54:43 +02:00
Jeremiah Senkpiel
cbd8d715b2
fs: introduce opendir() and fs.Dir
...
This adds long-requested methods for asynchronously interacting and
iterating through directory entries by using `uv_fs_opendir`,
`uv_fs_readdir`, and `uv_fs_closedir`.
`fs.opendir()` and friends return an `fs.Dir`, which contains methods
for doing reads and cleanup. `fs.Dir` also has the async iterator
symbol exposed.
The `read()` method and friends only return `fs.Dirent`s for this API.
Having a entry type or doing a `stat` call is deemed to be necessary in
the majority of cases, so just returning dirents seems like the logical
choice for a new api.
Reading when there are no more entries returns `null` instead of a
dirent. However the async iterator hides that (and does automatic
cleanup).
The code lives in separate files from the rest of fs, this is done
partially to prevent over-pollution of those (already very large)
files, but also in the case of js allows loading into `fsPromises`.
Due to async_hooks, this introduces a new handle type of `DIRHANDLE`.
This PR does not attempt to make complete optimization of
this feature. Notable future improvements include:
- Moving promise work into C++ land like FileHandle.
- Possibly adding `readv()` to do multi-entry directory reads.
- Aliasing `fs.readdir` to `fs.scandir` and doing a deprecation.
Refs: https://github.com/nodejs/node-v0.x-archive/issues/388
Refs: https://github.com/nodejs/node/issues/583
Refs: https://github.com/libuv/libuv/pull/2057
PR-URL: https://github.com/nodejs/node/pull/29349
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: David Carlier <devnexen@gmail.com >
2019-10-08 10:34:48 -07:00
cjihrig
53816cce69
fs: add recursive option to rmdir()
...
This commit adds a recursive option to fs.rmdir(),
fs.rmdirSync(), and fs.promises.rmdir(). The implementation
is a port of the npm module rimraf.
PR-URL: https://github.com/nodejs/node/pull/29168
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Roman Reiss <me@silverwind.io >
Reviewed-By: Ben Coe <bencoe@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
2019-08-23 13:59:07 -07:00
cjihrig
8d100c21c5
fs: use consistent buffer array validation
...
This commit updates fs.writev() and fs.writevSync() to use the
same validation method as filehandle.writev().
PR-URL: https://github.com/nodejs/node/pull/29186
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-08-19 15:34:40 -04:00
cjihrig
9f9a201cc6
fs: validate writev fds consistently
...
This commit updates the recently added writev methods
to validate file descriptors like the other fs methods do.
PR-URL: https://github.com/nodejs/node/pull/29185
Refs: https://github.com/nodejs/node/pull/25925
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-08-19 15:13:34 -04:00
cjihrig
3238232fc4
lib: rename validateSafeInteger to validateInteger
...
validateInteger() was renamed to validateSafeInteger() in
https://github.com/nodejs/node/pull/26572 . However, this
function also works with unsafe integers. This commit restores
the old name, and adds some basic tests.
PR-URL: https://github.com/nodejs/node/pull/29184
Refs: https://github.com/nodejs/node/pull/26572
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2019-08-19 11:55:22 -04:00
Anas Aboureada
e4bbbcc84b
fs: add fs.writev() which exposes syscall writev()
...
fs with writev allow many buffers to be pushed to underlying OS
APIs in one batch, so this should improve write speed to files.
Refs: https://github.com/nodejs/node/issues/2298
PR-URL: https://github.com/nodejs/node/pull/25925
Fixes: https://github.com/nodejs/node/issues/2298
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-08-16 23:24:02 -07:00
Zach Bjornson
5e3b4d6ed9
fs: allow int64 offset in fs.write/writeSync/fd.write
...
Ref https://github.com/nodejs/node/issues/26563
PR-URL: https://github.com/nodejs/node/pull/26572
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-08-16 22:09:34 -07:00
Zach Bjornson
0bbda5e5ae
fs: allow int64 offset in fs.read/readSync/fd.read
...
Since v10.10.0, 'buf' can be any DataView, meaning the largest
byteLength can be Float64Array.BYTES_PER_ELEMENT * kMaxLength =
17,179,869,176.
'offset' can now be up to 2**53 - 1. This makes it possible to tile
reads into a large buffer.
Breaking: now throws if read offset is not a safe int, is null or
is undefined.
Fixes https://github.com/nodejs/node/issues/26563
PR-URL: https://github.com/nodejs/node/pull/26572
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-08-16 22:09:27 -07:00
Zach Bjornson
91a4cb7175
lib: rename validateInteger to validateSafeInteger
...
PR-URL: https://github.com/nodejs/node/pull/26572
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-08-16 22:09:24 -07:00
Tony Brix
4111c57f7c
fs: add default options for *stat()
...
PR-URL: https://github.com/nodejs/node/pull/29114
Fixes: https://github.com/nodejs/node/issues/29113
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-08-16 15:51:56 -07:00
cjihrig
c072a80717
fs: validate fds as int32s
...
This commit updates the JS layer's validation of file
descriptors to check for int32s >= 0 instead of uint32s.
PR-URL: https://github.com/nodejs/node/pull/28984
Fixes: https://github.com/nodejs/node/issues/28980
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-08-07 13:27:55 -07:00
Alex Pry
490c7e0606
lib: removed unnecessary fs.realpath options arg check + tests
...
Removed duplicated check for options argument of fs.realpath.
Added some tests which covering the cases for passing options arg
as null.
PR-URL: https://github.com/nodejs/node/pull/27909
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-05-30 15:02:11 +05:30
Richard Lau
1a96abe849
Revert "lib: print to stdout/stderr directly instead of using console"
...
This reverts commit 2b24ffae22 .
Fixes: https://github.com/nodejs/node/issues/27819
PR-URL: https://github.com/nodejs/node/pull/27823
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-05-26 16:44:16 +02:00
ZYSzys
23ef3e4cfb
fs: extract path conversion and validation to getValidatedPath
...
Almost all path validations within our file system are combined with:
```js
path = toPathIfFileURL(path);
validatePath(path);
```
So simply extracted them out into `getValidatedPath` function to
`internal/fs/utils.js` to DRY up the code and reduce duplicating them.
PR-URL: https://github.com/nodejs/node/pull/27656
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-05-14 15:13:48 -07:00
Anatoli Papirovski
f4f937b296
lib: remove Reflect.apply where appropriate
...
Using Reflect.apply where the callback context does not need
to change is unnecessary and less performant.
PR-URL: https://github.com/nodejs/node/pull/27349
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-04-30 08:36:55 +02:00
Joyee Cheung
2b24ffae22
lib: print to stdout/stderr directly instead of using console
...
This patch adds an internal function that prints to stdout or
stderr by directly writing to the known file descriptor, and
uses it internally in common cases to avoid the overhead
of the console implementation.
PR-URL: https://github.com/nodejs/node/pull/27320
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-04-28 14:46:23 +08:00
Michaël Zasso
908292cf1f
lib: enforce the use of Object from primordials
...
PR-URL: https://github.com/nodejs/node/pull/27146
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2019-04-12 05:38:45 +02:00
cjihrig
b925379f50
fs: warn on non-portable mkdtemp() templates
...
Refs: https://github.com/nodejs/node/issues/26435
PR-URL: https://github.com/nodejs/node/pull/26980
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-04-08 21:16:56 -04:00
Ruben Bridgewater
eb2d4161f5
fs: improve readFile performance
...
This increases the maximum buffer size per read to 512kb when using
`fs.readFile`. This is important to improve the read performance for
bigger files.
PR-URL: https://github.com/nodejs/node/pull/27063
Refs: https://github.com/nodejs/node/issues/25741
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jamie Davis <davisjam@vt.edu >
2019-04-07 11:28:15 +02:00
Ruben Bridgewater
3b044962c4
errors: add more information in case of invalid callbacks
...
This adds the actual callback that is passed through to the error
message in case an ERR_INVALID_CALLBACK error is thrown.
PR-URL: https://github.com/nodejs/node/pull/27048
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
2019-04-04 12:51:03 +02:00
Michaël Zasso
0817840f77
lib: force using primordials for JSON, Math and Reflect
...
Use the "no-restricted-globals" ESLint rule to lint for it.
PR-URL: https://github.com/nodejs/node/pull/27027
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-04-03 21:36:08 +08:00
Anna Henningsen
5583d4d73e
fs: remove experimental warning for fs.promises
...
This has been warning for long enough, without any API changes
in the last few months.
PR-URL: https://github.com/nodejs/node/pull/26581
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-04-02 14:20:05 +02:00
Ruben Bridgewater
b08a867d60
benchmark,doc,lib: capitalize more comments
...
PR-URL: https://github.com/nodejs/node/pull/26849
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
2019-03-27 17:20:06 +01:00
Ruben Bridgewater
7bddfcc61a
lib: consolidate arrayBufferView validation
...
There are lots of places that validate for arrayBufferView and we
have multiple functions that do the same thing. Instead, move the
validation into `internal/validators` so all files can use that
instead.
There are more functions throughout the code that do the same but
it takes some more work to fully consolidate all of those.
PR-URL: https://github.com/nodejs/node/pull/26809
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-27 17:05:19 +01:00
Ruben Bridgewater
50a3fe20ea
lib: rename validateMode to parseMode
...
The function did not only validate the mode but it returns a new
value depending on the input. Thus `validate` did not seem to be an
appropriate name.
PR-URL: https://github.com/nodejs/node/pull/26809
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-27 17:05:12 +01:00
Ruben Bridgewater
3fe1e80896
lib: validate Error.captureStackTrace() calls
...
This adds a custom eslint rule to verify that
`Error.captureStackTrace()` is only called if necessary. In most
cases the helper function should be used instead.
PR-URL: https://github.com/nodejs/node/pull/26738
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2019-03-23 02:55:55 +01:00
Ruben Bridgewater
bfbce289c3
lib: refactor Error.captureStackTrace() usage
...
When using `Errors.captureStackFrames` the error's stack property
is set again. This adds a helper function that wraps this functionality
in a simple API that does not only set the stack including the `code`
property but it also improves the performance to create the error.
The helper works for thrown errors and errors returned from wrapped
functions in case they are Node.js core errors.
PR-URL: https://github.com/nodejs/node/pull/26738
Fixes: https://github.com/nodejs/node/issues/26669
Fixes: https://github.com/nodejs/node/issues/20253
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2019-03-23 02:55:54 +01:00
Ruben Bridgewater
f8763bb077
benchmark,doc,lib,test: capitalize comments
...
PR-URL: https://github.com/nodejs/node/pull/26483
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-03-10 00:44:40 +01:00
Ruben Bridgewater
9edce1e12a
benchmark,doc,lib,test: capitalize comments
...
This updates a lot of comments.
PR-URL: https://github.com/nodejs/node/pull/26223
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
2019-02-28 18:31:10 +01:00
ZYSzys
e34d41e42e
fs: remove redundant callback check
...
PR-URL: https://github.com/nodejs/node/pull/25160
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-02-09 20:22:45 +01:00
ZYSzys
3681ddd967
fs: remove useless internalFS
...
PR-URL: https://github.com/nodejs/node/pull/25161
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-02-09 17:34:28 +01:00
Ruben Bridgewater
d4c91f2814
lib: remove internal util._extends() usage
...
This removes all internal calls to the deprecated `_extends()`
function. It is slower than `Object.assign()` and the object spread
notation since V8 6.8 and using the spread notation often also
results in shorter code.
PR-URL: https://github.com/nodejs/node/pull/25105
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2018-12-20 13:52:44 +01:00
Ruben Bridgewater
50dd555910
doc,lib,test: capitalize comment sentences
...
This activates the eslint capitalize comment rule for comments
above 50 characters.
PR-URL: https://github.com/nodejs/node/pull/24996
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2018-12-17 17:14:35 +01:00
Sakthipriyan Vairamani (thefourtheye)
8f4b924f4a
fs: make writeFile consistent with readFile wrt fd
...
As it is, `readFile` always reads from the current position of the file,
if a file descriptor is used. But `writeFile` always writes from the
beginning of the file.
This patch fixes this inconsistency by making `writeFile` also to write
from the current position of the file when used with a file descriptor.
PR-URL: https://github.com/nodejs/node/pull/23709
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: Rod Vagg <rod@vagg.org >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2018-12-15 12:54:50 -08:00
Ruben Bridgewater
1f85ea979c
tools: capitalize sentences
...
This adds the `capitalized-comments` eslint rule to verify that
actual sentences use capital letters as starting letters. It ignores
special words and all lines below 62 characters.
PR-URL: https://github.com/nodejs/node/pull/24808
Reviewed-By: Sam Ruby <rubys@intertwingly.net >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2018-12-10 17:07:18 +01:00
cjihrig
7ac939e106
fs: simplify fs.promises warning logic
...
fs.promises is lazy loaded. Instead of using a seaparate
Boolean flag to track whether or not it has been loaded, just
inspect the state of the lazy loaded module itself.
PR-URL: https://github.com/nodejs/node/pull/24788
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: Masashi Hirano <shisama07@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
2018-12-04 11:32:42 -08:00
Bartosz Sosnowski
cda6b20816
win, fs: detect if symlink target is a directory
...
On Windows creating a symlink to a directory will not work unless extra
'dir' parameter is passed. This adds a check if link target is a
directory, and if so automatically use 'dir' when creating symlink.
PR-URL: https://github.com/nodejs/node/pull/23724
Refs: https://github.com/nodejs/node/pull/23691
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rod Vagg <rod@vagg.org >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2018-11-29 11:28:39 -08:00
exoego
32b0958c58
lib: convert to arrow function in fs.js
...
PR-URL: https://github.com/nodejs/node/pull/24604
Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
2018-11-28 19:30:14 -08:00
Masashi Hirano
1e23e3ceb3
fs: make process.binding('fs') internal
...
Refs: https://github.com/nodejs/node/issues/22160
PR-URL: https://github.com/nodejs/node/pull/22478
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
2018-11-16 21:56:29 +09:00
Shelley Vohr
7cf56797dd
src: prefer param function check over args length
...
PR-URL: https://github.com/nodejs/node/pull/23835
Reviewed-By: Refael Ackermann <refack@gmail.com >
Reviewed-By: Matheus Marchini <mat@mmarchini.me >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Yuta Hiroto <hello@hiroppy.me >
2018-11-07 19:42:06 -08:00
cjihrig
9d68e56856
fs: remove unused catch bindings
...
PR-URL: https://github.com/nodejs/node/pull/24079
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
Reviewed-By: Wyatt Preul <wpreul@gmail.com >
2018-11-06 10:58:30 -05:00
Joyee Cheung
bcc7b7a58c
fs: handle result of access binding directly in fs.existsSync
...
Instead of throwing errors in fs.accessSync and then catching it,
handle the result from the binding directly in fs.existsSync.
Note that the argument validation errors still needs to be caught
until we properly deprecate the don't-thrown-on-invalid-arguments
behavior.
PR-URL: https://github.com/nodejs/node/pull/24015
Fixes: https://github.com/nodejs/node/issues/24008
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Refael Ackermann <refack@gmail.com >
2018-11-03 18:43:00 -07:00