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

problem with using fs.stat #428

Closed
Janice0218 opened this issue Sep 21, 2018 · 0 comments

Comments

@Janice0218
Copy link
Contributor

commented Sep 21, 2018

I was reading the code,
changed code

`it('should return an error if path does not exist', function(done) {

 var fs = util.fs();

 //'stat' should be 'lstat'

 fs.stat('/tmp', function(error, result) {

 expect(error).to.exist;

 expect(error.code).to.equal('ENOENT');

  expect(result).not.to.exist;

 done();
 });

});`

fs.stat should be fs.lstat.
there have a little bit different between those:
stat follows symlinks. When given a path that is a symlink, it returns the stat of the target of the symlink.
lstat doesn't follow symlinks. When given a path that is a symlink it returns the stat of the symlink.
When a file is a symbolic link, lstat returns information about the symbolic link itself( '/myfilelink');
stat returns information about the file pointed to by the link( '/').

Janice0218 added a commit to Janice0218/filer that referenced this issue Sep 22, 2018
@humphd humphd closed this Dec 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.