-
-
Notifications
You must be signed in to change notification settings - Fork 125
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.readFile reads wrong file after renaming parent dir #282
Comments
If in step 5 you rename This works for me var fs = require("memfs")
fs.mkdirSync('/dir');
fs.writeFileSync('/dir/file.ext', 'asdf');
fs.readFileSync('/dir/file.ext');
fs.renameSync('/dir/file.ext', '/dir/newfile.ext');
console.log(fs.readFileSync('/dir/newfile.ext', 'utf8')); |
@streamich try this reproduction, please: 🙏 const fs = require('memfs');
fs.mkdirSync('dir', { recursive: true });
fs.writeFileSync('dir/file.ext', 'asdf');
fs.renameSync('dir', 'newdir');
fs.readFileSync('newdir/file.ext', 'utf8'); Still tries to read from the old path:
Note: it works just fine with |
Also note: |
@falkenhawk your reproduction works fine for me using the latest version of |
Steps to reproduce :
fs.mkdirSync('/dir');
fs.writeFileSync('/dir/file.ext');
fs.readFileSync('/dir/file.ext');
//returns Buffer[]
fs.renameSync('/dir/file.ext', '/dir/newfile.ext');
fx.readFileSync('/dir/newfile.ext');
// Throws Error
Error: ENOENT: no such file or directory, open '/dir/file.ext'
Even though new file name is entered in readFileSync, it still tries to look for the old file?
The text was updated successfully, but these errors were encountered: