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

fs.exists is bad example for docs #972

Closed
ex1st opened this issue Dec 3, 2015 · 2 comments
Closed

fs.exists is bad example for docs #972

ex1st opened this issue Dec 3, 2015 · 2 comments

Comments

@ex1st
Copy link

ex1st commented Dec 3, 2015

https://nodejs.org/dist/v4.2.2/docs/api/fs.html#fs_fs_exists_path_callback
Stability: 0 - Deprecated: Use fs.stat or fs.access instead.

Now all async functions without error in callback are deprecated (node.js). Need to change examples.
I also suggest change methods like filter and reject in 2.0 for consistency with node.js practics.

async.filter(['file1','file2','file3'], function (file, cb) { 
    fs.stat(file, function(err, stat){
        cb(null, !err);
    });
}, function (err, results) {
    // results now equals an array of the existing files
});

What do you think?

@aearly
Copy link
Collaborator

aearly commented Dec 3, 2015

We're going to change how these functions work in the next major release: #118 . As they exist today, fs.exists is just about the only function that's useful for these methods.

@ex1st
Copy link
Author

ex1st commented Dec 3, 2015

Ok, thanks.

@ex1st ex1st closed this as completed Dec 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants