![]() |
The ensureLinkSync() function is the synchronous version of ensureLink(). The function makes sure that the link between the two given files exists. The source file needs to exist already otherwise the function will throw an error. If the directory structure of the destination file does not exist then it will be created by the function and a link will be established between the source file and the destination file. createLinkSync() can also be used in place of ensureLinkSync(). Syntax: ensureLinkSync(srcPath, destPath) // OR createLinkSync(srcPath, destPath) Parameters:
Return value: It does not return anything. Follow the steps to implement the function:
Project Structure: The project structure will look like this. Example 1: index.js
Output: Example 2: Javascript
Output: Reference: https://github.com/jprichardson/node-fs-extra/blob/HEAD/docs/ensureLink-sync.md |
Reffered: https://www.geeksforgeeks.org
JavaScript |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 10 |