create-symlink

Create a symbolic link


Keywords
symlink, symblic, link, file, junction, fs, path, promise, promisified, async
License
MIT
Install
npm install create-symlink@1.0.0

Documentation

create-symlink

npm version Build Status Coverage Status

A Node.js module to create a symbolic link

const createSymlink = require('create-symlink');
const {realpath} = require('fs').promises;

(async () => {
  await createSymlink('/where/file/exists', 'where/to/create/symlink');
  await realpath('where/to/create/symlink'); //=> '/where/file/exists'
})();

Installation

Use npm.

npm install create-symlink

API

const createSymlink = require('create-symlink');

createSymlink(target, path [, option])

target: string (symlink target)
path: string (a path where you create a symlink)
option: Object
Return: Promise

Almost the same as the built-in fs.promises.symlink(), but the third parameter receives an object with type property, instead of receiving a string directly.

(async () => {
  await createSymlink('src', 'dest', {type: 'junction'});
  // Created a junction point (Windows only)
})();

License

ISC License © 2018 Shinnosuke Watanabe