Ensures that the link 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 callback} {\ttfamily $<$Function$>$}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_fs_extra_docs_ensureLink_autotoc_md11009}{}\doxysection{Example\+:}\label{md_sfcode_node_modules_fs_extra_docs_ensureLink_autotoc_md11009}

\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.ensureLink(srcpath, dstpath, err => \{}
\DoxyCodeLine{  console.log(err) // => null}
\DoxyCodeLine{  // link has now been created, including the directory it is to be placed in}
\DoxyCodeLine{\})}
\DoxyCodeLine{}
\DoxyCodeLine{// With Promises:}
\DoxyCodeLine{fs.ensureLink(srcpath, dstpath)}
\DoxyCodeLine{.then(() => \{}
\DoxyCodeLine{  console.log('success!')}
\DoxyCodeLine{\})}
\DoxyCodeLine{.catch(err => \{}
\DoxyCodeLine{  console.error(err)}
\DoxyCodeLine{\}) }

\end{DoxyCode}
 