When using the ln command line tool, we can do this using the -f (force) flag
ln -sf target symlink-name
However, this is not possible with the fs API if we do not implement this function in the module.
I created lnf , a module for overriding existing symbolic links.
// Dependencies var Lnf = require("lnf"); // Create the symlink Lnf.sync("foo", __dirname + "/baz"); // Override it Lnf("bar", __dirname + "/baz", function (err) { console.log(err || "Overriden the baz symlink."); });
Read the full documentation in the GitHub repository
source share