fs.link() on windows makes a file same as srcFile, I guess it isn't a link file.

997 views
Skip to first unread message

Andrew Goal

unread,
May 24, 2012, 8:58:17 AM5/24/12
to nodejs
fs.link() on windows makes a file same as srcFile, I guess it isn't a
link file.

But I don't know what is the true hard link file created by
CreateHardLinkW() , is it like a shortcut .lnk file created by context
menu with mouse right click?

How can I recognise a file is a hard link file on windows?

my nodejs:

versions:
{ node: '0.6.15',
v8: '3.6.6.24',
ares: '1.7.5-DEV',
uv: '0.6',
openssl: '0.9.8r' },

Matt Patenaude

unread,
May 24, 2012, 9:34:21 AM5/24/12
to nod...@googlegroups.com
I think you're confusing hard links and soft links (symlinks). A symlink is like a shortcut (and probably is represented as one on Windows). A hard link plays the same role as the original filesystem entry: it exposes an inode as an entry in a directory. A hard link is indistinguishable from a regular file — because for all intents and purposes, it is a regular file — with the only noticeable difference being that it shares the same inode (and therefore, permissions, attributes, and contents) as the source file. Even though they appear to be different files, if you change one, the change will be reflected in the other because they share a physical data location on disk.

In short, a symlink is a pointer to a filename that the operating system is capable of resolving. A hard link is a way to associate more than one filename with a physical "file". It's also worth noting that hard links are only supported on Windows on NTFS filesystems.


Hope that helps!

-Matt

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Oleg Efimov (Sannis)

unread,
May 24, 2012, 10:26:25 AM5/24/12
to nod...@googlegroups.com
fs.link() on Windows creates hardlink, fs.symlink() creates junction. you can read about difference in http://msdn.microsoft.com/en-us/library/windows/desktop/aa365006(v=vs.85).aspx

четверг, 24 мая 2012 г., 16:58:17 UTC+4 пользователь Andrew Goal написал:

Bert Belder

unread,
May 24, 2012, 8:07:30 PM5/24/12
to nodejs
On May 24, 4:26 pm, "Oleg Efimov (Sannis)" <efimo...@gmail.com> wrote:
> fs.link() on Windows creates hardlink, fs.symlink() creates junction. you
> can read about difference inhttp://msdn.microsoft.com/en-us/library/windows/desktop/aa365006(v=vs...

fs.symlink() actually create symlinks on windows (although this is not
supported on windows XP/2k3). Node 0.8 will have the ability to
actually create junctions.

- Bert

Andrew Goal

unread,
May 25, 2012, 3:47:23 AM5/25/12
to nod...@googlegroups.com
Thank you very much,everyone!
You are so kind.

I want to create a symlink like linux's , but I have known symlink or hard link on windows must in NTFS.
Windows is a trouble.

.lnk files meet my need in fact, though .lnk file is only useful in Explorer.exe shell. 
But there is no API that can create .lnk files, maybe I will write one.


Message has been deleted

Andrew Goal

unread,
May 25, 2012, 5:57:21 AM5/25/12
to nodejs
fs.link() works fine on my windows xp sp3 box .
I have recognised these hard link files now.

Reply all
Reply to author
Forward
0 new messages