-
Notifications
You must be signed in to change notification settings - Fork 221
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
Support symlinks on core backends #268
Comments
any one know how to create symlinks? Apparently they are readable, which is a good sign! any help appreciated: https://stackoverflow.com/questions/55131565/how-to-create-a-symlink-within-browserfs @jvilk 🙏🏻 |
@pyramation I don't believe any backend currently supports symlinks. The basic abstraction is there should someone want to implement a backend that supports them, but I never got around to supporting them in the core backends. |
Thank you @jvilk! Do you have an idea of how one could implement it for the Memory or LocalStorage backends? I'd be happy to dive in if there are some conceptual models for how to create the symlink. I had one idea... I did look into potentially changing modes, and setting the contents manually. I found from this link that symlinks are mode Any pointers on this thread are appreciated and I imagine would contribute to the creation of this feature ;) |
The contents of a symlink is the path to the file you're symlinking. So a symlink to To implement symlinks, you'll need to somehow denote in the metadata of the file that it's a symlink (I think it's stashed in the mode as you suspect -- we stash file/dir in the mode as well), and then store it as a file with the contents of the symlink. |
Thanksd @jvilk ! I tried this out, and having issues editing mode. What's the best way to edit the mode or get into the metadata? I'm attempting to use I'm trying to use chmod because If we try and write the mode on creation, we get issues because of umask, e.g., fs.writeFileSync("value.txt", "hello world");
fs.writeFileSync("alias", "./value.txt", {
mode: 12000
});
console.log(fs.statSync("alias").mode.toString(8)); Which prints fs.chmodSync("alias", 12000); Then I get a nice not supported error: |
Hey @pyramation, did you manage to figure this out. I'm hitting the same problem. Also, from the link that you posted should the mode change due to unix permissions for symlinks? It might make it easy to implement it If it doesn't.
Also would readdir/readlink support symlinks automatically if we can figure this out? I think readdir might, but how would readlink know that it's a symlink if the mode changes? Does lstat help?
|
hey @abhishiv I don't think I ever got this working, nor did I see if there was work on it. Happy to see that more people want this feature, hopefully it can happen :) |
chmod is supported with #334 If you do get it working a PR would definitely be welcome. |
Hey @james-pre Has #334 been release? I'm on 1.4.3, and I still get ENOTSUP EDIT: also doesn't work with 2.0.0 |
Also, @abhishiv I plan on working on this after I get the internal API converted to promises. It is long overdue and something that should be relatively easy to implement. |
Please use zen-fs/core#17 |
I've been reading the docs and I'm under the impression that the core filesystems have symlinks?
I'm currently getting
ENOTSUP
not supported errors, so curious if there are any examples or pointers for getting symlinks to work, thanks!The text was updated successfully, but these errors were encountered: