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

BUG: utimesSync doesn't work on directories, but it should #864

Closed
williamstein opened this issue Oct 25, 2022 · 1 comment
Closed

BUG: utimesSync doesn't work on directories, but it should #864

williamstein opened this issue Oct 25, 2022 · 1 comment

Comments

@williamstein
Copy link
Contributor

~/cowasm/packages/wasi-js$ node
Welcome to Node.js v19.0.0.
Type ".help" for more information.
> memfs = require('memfs');0;
0
> memfs.vol.fromJSON({'/a/b':'this is b'}, '/');
undefined
> memfs.vol.readdirSync('/a')
[ 'b' ]
> memfs.vol.utimesSync('/a',new Date(), new Date())
Uncaught Error: EISDIR: illegal operation on a directory, open '/a'
    at createError (/Users/wstein/build/cocalc/src/data/projects/2c9318d1-4f8b-4910-8da7-68a965514c95/cowasm/packages/wasi-js/node_modules/memfs/lib/volume.js:128:17)
    at Volume.openLink (/Users/wstein/build/cocalc/src/data/projects/2c9318d1-4f8b-4910-8da7-68a965514c95/cowasm/packages/wasi-js/node_modules/memfs/lib/volume.js:814:23)
    at Volume.openFile (/Users/wstein/build/cocalc/src/data/projects/2c9318d1-4f8b-4910-8da7-68a965514c95/cowasm/packages/wasi-js/node_modules/memfs/lib/volume.js:853:25)
    at Volume.openBase (/Users/wstein/build/cocalc/src/data/projects/2c9318d1-4f8b-4910-8da7-68a965514c95/cowasm/packages/wasi-js/node_modules/memfs/lib/volume.js:858:25)
    at Volume.openSync (/Users/wstein/build/cocalc/src/data/projects/2c9318d1-4f8b-4910-8da7-68a965514c95/cowasm/packages/wasi-js/node_modules/memfs/lib/volume.js:869:21)
    at Volume.utimesBase (/Users/wstein/build/cocalc/src/data/projects/2c9318d1-4f8b-4910-8da7-68a965514c95/cowasm/packages/wasi-js/node_modules/memfs/lib/volume.js:1538:23)
    at Volume.utimesSync (/Users/wstein/build/cocalc/src/data/projects/2c9318d1-4f8b-4910-8da7-68a965514c95/cowasm/packages/wasi-js/node_modules/memfs/lib/volume.js:1547:14) {
  code: 'EISDIR'
}
> 

Using the normal filesystem, utimesSync works fine:

/tmp$ mkdir a
/tmp$ node
Welcome to Node.js v19.0.0.
Type ".help" for more information.
> require('fs').utimesSync('a', new Date(), new Date())
undefined
> 
@williamstein
Copy link
Contributor Author

Sorry, I see this is a dup of #391

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

1 participant