Ensures that the symlink exists. If the directory structure does not exist, it is created.


\begin{DoxyItemize}
\item {\ttfamily srcpath} {\ttfamily $<$String$>$}
\item {\ttfamily dstpath} {\ttfamily $<$String$>$}
\item {\ttfamily type} {\ttfamily $<$String$>$}
\item {\ttfamily callback} {\ttfamily $<$Function$>$}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_fs_extra_docs_ensureSymlink_autotoc_md11013}{}\doxysection{Example\+:}\label{md_sfcode_node_modules_fs_extra_docs_ensureSymlink_autotoc_md11013}

\begin{DoxyCode}{0}
\DoxyCodeLine{const fs = require('fs-\/extra')}
\DoxyCodeLine{}
\DoxyCodeLine{const srcpath = '/tmp/file.txt'}
\DoxyCodeLine{const dstpath = '/tmp/this/path/does/not/exist/file.txt'}
\DoxyCodeLine{fs.ensureSymlink(srcpath, dstpath, err => \{}
\DoxyCodeLine{  console.log(err) // => null}
\DoxyCodeLine{  // symlink has now been created, including the directory it is to be placed in}
\DoxyCodeLine{\})}
\DoxyCodeLine{}
\DoxyCodeLine{// With Promises:}
\DoxyCodeLine{fs.ensureSymlink(srcpath, dstpath)}
\DoxyCodeLine{.then(() => \{}
\DoxyCodeLine{  console.log('success!')}
\DoxyCodeLine{\})}
\DoxyCodeLine{.catch(err => \{}
\DoxyCodeLine{  console.error(err)}
\DoxyCodeLine{\}) }

\end{DoxyCode}
 