Node.js fsPromises.symlink() Method Last Updated : 08 Oct, 2021 Comments Improve Suggest changes Like Article Like Report The fsPromises.symlink() method is used to create a symlink to the specified path then resolves the Promise with no arguments upon success. This creates a link making the path point to the target. The relative targets are relative to the linkâs parent directory. Syntax: fsPromises.symlink( target, path, type ) Parameters: This method accept three parameters as mentioned above and described below: target: It is a string, buffer or URL which represents the path to which the symlink has to be created.path: It is a string, buffer or URL which represents the path where the symlink will be created.type: It is a string which represents the type of symlink to be created. It can be specified with âfileâ, âdirâ or âjunctionâ. If the target does not exist, âfileâ will be used. The type argument is only used on Windows platforms and can be one of 'dir', 'file', or 'junction'. Windows junction points require the destination path to be absolute. When using 'junction', the target argument will automatically be normalized to absolute path. Example: This example illustrates the fsPromises.symlink() method in Node.js: Filename: index.js javascript // Node.js program to demonstrate the // fsPromises.symlink method // Import the filesystem module const fs = require('fs'); const fsPromises = fs.promises; console.log("Contents of the text file:"); console.log(fs.readFileSync( 'example_file.txt', 'utf8')); fsPromises.symlink(__dirname + "\\example_file.txt", "symlinkToFile", 'file') .then(function() { console.log("\nSymlink created\n"); console.log("Contents of the symlink created:"); console.log(fs.readFileSync('symlinkToFile', 'utf8')); }) .catch(function(error) { console.log(error); }); Step to run this program: Run index.js file using the following command: node index.js Output: Contents of the text file: Hello Geeks Symlink created Contents of the symlink created: Hello Geeks Reference: https://nodejs.org/api/fs.html#fs_fspromises_symlink_target_path_type Create Quiz Comment N nitin_sharma Follow 0 Improve N nitin_sharma Follow 0 Improve Article Tags : Node.js Node.js-fs-module Explore Introduction & Installation NodeJS Introduction3 min readNode.js Roadmap: A Complete Guide6 min readHow to Install Node.js on Linux6 min readHow to Install Node.js on Windows5 min readHow to Install NodeJS on MacOS6 min readNode.js vs Browser - Top Differences That Every Developer Should Know6 min readNodeJS REPL (READ, EVAL, PRINT, LOOP)4 min readExplain V8 engine in Node.js7 min readNode.js Web Application Architecture3 min readNodeJS Event Loop5 min readNode.js Modules , Buffer & StreamsNodeJS Modules5 min readWhat are Buffers in Node.js ?4 min readNode.js Streams4 min readNode.js Asynchronous ProgrammingAsync Await in Node.js3 min readPromises in NodeJS7 min readHow to Handle Errors in Node.js ?4 min readException Handling in Node.js3 min readNode.js NPMNodeJS NPM6 min readSteps to Create and Publish NPM packages7 min readIntroduction to NPM scripts2 min readNode.js package.json4 min readWhat is package-lock.json ?3 min readNode.js Deployments & CommunicationNode Debugging2 min readHow to Perform Testing in Node.js ?2 min readUnit Testing of Node.js Application5 min readNODE_ENV Variables and How to Use Them ?2 min readDifference Between Development and Production in Node.js3 min readBest Security Practices in Node.js4 min readDeploying Node.js Applications5 min readHow to Build a Microservices Architecture with NodeJS3 min readNode.js with WebAssembly3 min readResources & ToolsNode.js Web Server6 min readNode Exercises, Practice Questions and Solutions4 min readNode.js Projects9 min readNodeJS Interview Questions and Answers15+ min read Like