Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Begin docs-deprecation of fs.readdir{Sync}(), add fs.scandirSync() alias. #36008

Closed
wants to merge 2 commits into from

Commits on Nov 6, 2020

  1. fs: add scandirSync(), rename internals to scandir

    This is a follow-up to
    nodejs#29349
    and a precursor to deprecating both `fs.readdir()`
    and `fs.readdirSync()`.
    
    This also updates the documentation which has been incorrect
    for some 10 years saying that these did `readdir(3)` when in
    reality they do `scandir(3)`.
    
    Only `scandirSync()` is introduced as "async scandir(3)" is
    kind of a trap, given that it returns the whole list of entries
    at once, regardless of how many there are. Since in many
    cases we'd also want to get dirents for them (i.e. `stat`-ing
    each and every one), this becomes a serious problem, and
    Node.js should encourage users to use `fs.opendir()`, which
    is slightly more complex but far better.
    Fishrock123 committed Nov 6, 2020
    Configuration menu
    Copy the full SHA
    35d1c50 View commit details
    Browse the repository at this point in the history
  2. fs,doc: docs-deprecate fs.readdir{Sync}()

    It's time overdue for these to start going away.
    
    `fs.opendir()` was introduced over a year ago in
    nodejs#29349 - which stated
    a follow-up of:
    "Aliasing fs.readdir to fs.scandir and doing a deprecation."
    
    This provides the intial docs deprecation to both `fs.readdir()`
    and `fs.readdirSync()`, both of which are misnamed, and
    the former of which is a trap as it is not fully async.
    Fishrock123 committed Nov 6, 2020
    Configuration menu
    Copy the full SHA
    792b6c4 View commit details
    Browse the repository at this point in the history