You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fs.truncate accepts an fd but it's poorly documented #15753
But this behavior is surprising, since there's fs.ftruncate for fds and it's easy to overlook the note in the documentation for fs.truncate.
Options:
Improve documentation for fs.truncate to make it more obvious that it also takes fds. For instance, path <string> | <Buffer> needs to be replaced with something like pathOrFd <string> | <Buffer> | <number>, and Asynchronous truncate(2). needs to be replaced with something like Asynchronous truncate(2) or ftruncate(2) depending on the argument.
Phase out fd support in fs.truncate. This would be my preference, since it would avoid having two functions that can do the same thing, and it would make code such as fs.truncate(f) more readable because it would be obvious that f is a path and not an fd.
Activity
r1cebank commentedon Oct 6, 2017
@Fishrock123 @mscdex I will start work on this in favor of deprecation
benjamingr commentedon Nov 15, 2017
Closed with #15990