Giter VIP home page Giter VIP logo

Comments (4)

streamich avatar streamich commented on May 20, 2024

If in step 5 you rename fx to fs, does it work?

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'));

from memfs.

falkenhawk avatar falkenhawk commented on May 20, 2024

@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:

Error: ENOENT: no such file or directory, open '/(...)/dir/file.ext'

Note: it works just fine with const fs = require('fs');

from memfs.

falkenhawk avatar falkenhawk commented on May 20, 2024

Also note: statSync('newdir/file.ext'), accessSync, existsSync all work fine after rename!
But vol.toJSON() still lists the file under the "old" path:
{ '/(...)/dir/file.ext': 'asdf' }

from memfs.

G-Rath avatar G-Rath commented on May 20, 2024

@falkenhawk your reproduction works fine for me using the latest version of memfs so I'm going to close this as hopefully its been fixed - feel free to open a new issue if you have any further problems.

from memfs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.