\begin{quote}
List files and directories inside the specified directory. \end{quote}
\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2033}{}\doxysection{\+:bulb\+: Highlights}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2033}
The package is aimed at obtaining information about entries in the directory.


\begin{DoxyItemize}
\item \+:moneybag\+: Returns useful information\+: {\ttfamily name}, {\ttfamily path}, {\ttfamily dirent} and {\ttfamily stats} (optional).
\item \+:gear\+: On Node.\+js 10.\+10+ uses the mechanism without additional calls to determine the entry type. See \href{\#old-and-modern-mode}{\texttt{ {\ttfamily old} and {\ttfamily modern} mode}}.
\item \+:link\+: Can safely work with broken symbolic links.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2034}{}\doxysection{Install}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2034}

\begin{DoxyCode}{0}
\DoxyCodeLine{npm install @nodelib/fs.scandir }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2035}{}\doxysection{Usage}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2035}

\begin{DoxyCode}{0}
\DoxyCodeLine{import * as fsScandir from '@nodelib/fs.scandir';}
\DoxyCodeLine{}
\DoxyCodeLine{fsScandir.scandir('path', (error, stats) => \{ /* … */ \}); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2036}{}\doxysection{API}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2036}
\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2037}{}\doxysubsection{.\+scandir(path, \mbox{[}options\+Or\+Settings\mbox{]}, callback)}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2037}
Returns an array of plain objects (\href{\#entry}{\texttt{ {\ttfamily Entry}}}) with information about entry for provided path with standard callback-\/style.


\begin{DoxyCode}{0}
\DoxyCodeLine{fsScandir.scandir('path', (error, entries) => \{ /* … */ \});}
\DoxyCodeLine{fsScandir.scandir('path', \{\}, (error, entries) => \{ /* … */ \});}
\DoxyCodeLine{fsScandir.scandir('path', new fsScandir.Settings(), (error, entries) => \{ /* … */ \}); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2038}{}\doxysubsection{.\+scandir\+Sync(path, \mbox{[}options\+Or\+Settings\mbox{]})}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2038}
Returns an array of plain objects (\href{\#entry}{\texttt{ {\ttfamily Entry}}}) with information about entry for provided path.


\begin{DoxyCode}{0}
\DoxyCodeLine{const entries = fsScandir.scandirSync('path');}
\DoxyCodeLine{const entries = fsScandir.scandirSync('path', \{\});}
\DoxyCodeLine{const entries = fsScandir.scandirSync(('path', new fsScandir.Settings()); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2039}{}\doxysubsubsection{path}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2039}

\begin{DoxyItemize}
\item Required\+: {\ttfamily true}
\item Type\+: {\ttfamily string $\vert$ Buffer $\vert$ URL}
\end{DoxyItemize}

A path to a file. If a URL is provided, it must use the {\ttfamily file\+:} protocol.\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2040}{}\doxysubsubsection{options\+Or\+Settings}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2040}

\begin{DoxyItemize}
\item Required\+: {\ttfamily false}
\item Type\+: {\ttfamily Options $\vert$ Settings}
\item Default\+: An instance of {\ttfamily Settings} class
\end{DoxyItemize}

An \href{\#options}{\texttt{ {\ttfamily Options}}} object or an instance of \href{\#settingsoptions}{\texttt{ {\ttfamily Settings}}} class.

\begin{quote}
\+:book\+: When you pass a plain object, an instance of the {\ttfamily Settings} class will be created automatically. If you plan to call the method frequently, use a pre-\/created instance of the {\ttfamily Settings} class. \end{quote}
\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2041}{}\doxysubsection{Settings(\mbox{[}options\mbox{]})}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2041}
A class of full settings of the package.


\begin{DoxyCode}{0}
\DoxyCodeLine{const settings = new fsScandir.Settings(\{ followSymbolicLinks: false \});}
\DoxyCodeLine{}
\DoxyCodeLine{const entries = fsScandir.scandirSync('path', settings); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2042}{}\doxysection{Entry}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2042}

\begin{DoxyItemize}
\item {\ttfamily name} — The name of the entry ({\ttfamily unknown.\+txt}).
\item {\ttfamily path} — The path of the entry relative to call directory ({\ttfamily root/unknown.\+txt}).
\item {\ttfamily dirent} — An instance of \href{./src/types/index.ts}{\texttt{ {\ttfamily fs.\+Dirent}}} class. On Node.\+js below 10.\+10 will be emulated by \href{./src/utils/fs.ts}{\texttt{ {\ttfamily Dirent\+From\+Stats}}} class.
\item {\ttfamily stats} (optional) — An instance of {\ttfamily fs.\+Stats} class.
\end{DoxyItemize}

For example, the {\ttfamily scandir} call for {\ttfamily tools} directory with one directory inside\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\{}
\DoxyCodeLine{    dirent: Dirent \{ name: 'typedoc', /* … */ \},}
\DoxyCodeLine{    name: 'typedoc',}
\DoxyCodeLine{    path: 'tools/typedoc'}
\DoxyCodeLine{\} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2043}{}\doxysection{Options}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2043}
\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2044}{}\doxysubsection{stats}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2044}

\begin{DoxyItemize}
\item Type\+: {\ttfamily boolean}
\item Default\+: {\ttfamily false}
\end{DoxyItemize}

Adds an instance of {\ttfamily fs.\+Stats} class to the \href{\#entry}{\texttt{ {\ttfamily Entry}}}.

\begin{quote}
\+:book\+: Always use {\ttfamily fs.\+readdir} without the {\ttfamily with\+File\+Types} option. ??TODO?? \end{quote}
\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2045}{}\doxysubsection{follow\+Symbolic\+Links}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2045}

\begin{DoxyItemize}
\item Type\+: {\ttfamily boolean}
\item Default\+: {\ttfamily false}
\end{DoxyItemize}

Follow symbolic links or not. Call {\ttfamily fs.\+stat} on symbolic link if {\ttfamily true}.\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2046}{}\doxysubsection{$<$tt$>$throw\+Error\+On\+Broken\+Symbolic\+Link$<$/tt$>$}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2046}

\begin{DoxyItemize}
\item Type\+: {\ttfamily boolean}
\item Default\+: {\ttfamily true}
\end{DoxyItemize}

Throw an error when symbolic link is broken if {\ttfamily true} or safely use {\ttfamily lstat} call if {\ttfamily false}.\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2047}{}\doxysubsection{$<$tt$>$path\+Segment\+Separator$<$/tt$>$}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2047}

\begin{DoxyItemize}
\item Type\+: {\ttfamily string}
\item Default\+: {\ttfamily path.\+sep}
\end{DoxyItemize}

By default, this package uses the correct path separator for your OS ({\ttfamily \textbackslash{}} on Windows, {\ttfamily /} on Unix-\/like systems). But you can set this option to any separator character(s) that you want to use instead.\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2048}{}\doxysubsection{$<$tt$>$fs$<$/tt$>$}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2048}

\begin{DoxyItemize}
\item Type\+: \href{./src/adapters/fs.ts}{\texttt{ {\ttfamily File\+System\+Adapter}}}
\item Default\+: A default FS methods
\end{DoxyItemize}

By default, the built-\/in Node.\+js module ({\ttfamily fs}) is used to work with the file system. You can replace any method with your own.


\begin{DoxyCode}{0}
\DoxyCodeLine{interface FileSystemAdapter \{}
\DoxyCodeLine{    lstat?: typeof fs.lstat;}
\DoxyCodeLine{    stat?: typeof fs.stat;}
\DoxyCodeLine{    lstatSync?: typeof fs.lstatSync;}
\DoxyCodeLine{    statSync?: typeof fs.statSync;}
\DoxyCodeLine{    readdir?: typeof fs.readdir;}
\DoxyCodeLine{    readdirSync?: typeof fs.readdirSync;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{const settings = new fsScandir.Settings(\{}
\DoxyCodeLine{    fs: \{ lstat: fakeLstat \}}
\DoxyCodeLine{\}); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2049}{}\doxysection{$<$tt$>$old$<$/tt$>$ and $<$tt$>$modern$<$/tt$>$ mode}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2049}
This package has two modes that are used depending on the environment and parameters of use.\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2050}{}\doxysubsection{old}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2050}

\begin{DoxyItemize}
\item Node.\+js below {\ttfamily 10.\+10} or when the {\ttfamily stats} option is enabled
\end{DoxyItemize}

When working in the old mode, the directory is read first ({\ttfamily fs.\+readdir}), then the type of entries is determined ({\ttfamily fs.\+lstat} and/or {\ttfamily fs.\+stat} for symbolic links).\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2051}{}\doxysubsection{modern}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2051}

\begin{DoxyItemize}
\item Node.\+js 10.\+10+ and the {\ttfamily stats} option is disabled
\end{DoxyItemize}

In the modern mode, reading the directory ({\ttfamily fs.\+readdir} with the {\ttfamily with\+File\+Types} option) is combined with obtaining information about its entries. An additional call for symbolic links ({\ttfamily fs.\+stat}) is still present.

This mode makes fewer calls to the file system. It\textquotesingle{}s faster.\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2052}{}\doxysection{Changelog}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2052}
See the \href{https://github.com/nodelib/nodelib/releases}{\texttt{ Releases section of our Git\+Hub project}} for changelog for each release version.\hypertarget{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2053}{}\doxysection{License}\label{md_sfcode_node_modules__nodelib_fs_scandir_README_autotoc_md2053}
This software is released under the terms of the MIT license. 