Created
February 23, 2018 14:49
-
-
Save Neoglyph/53cc35b804a2807e18d357d788b87ce9 to your computer and use it in GitHub Desktop.
Create symlink in nodejs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
const path = require('path') | |
const createSymlink = require('create-symlink') | |
const appDir = path.dirname(require.main.filename) | |
const original = /*...*/ | |
const link = /*...*/ | |
if (!fs.existsSync(original)) { | |
console.error('Can not create symlink. Original folder does not exist!') | |
return | |
} | |
if (fs.existsSync(link)) { | |
console.info('Symlink already exists.') | |
return | |
} | |
createSymlink(original, link) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment