[![npm version](https://badge.fury.io/js/@wixc3%2Ffs-utils.svg)](https://badge.fury.io/js/@wixc3%2Ffs-utils)
[@wixc3/fs-utils on Github](https://github.com/dazl-dev/core3-utils/tree/main/packages/fs-utils)

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](https://dazl-dev.github.io/core3-utils/index) &gt; [@wixc3/fs-utils](https://dazl-dev.github.io/core3-utils/fs-utils)

## fs-utils package

## Functions

| Function                                                                                                                                                  | Description                                                                                                                                          |
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| [addRelativePrefix(path)](https://dazl-dev.github.io/core3-utils/fs-utils.addrelativeprefix)                                                           |                                                                                                                                                      |
| [createImportPath({ importedFilePath, targetFilePath, targetPackageJsonPath, fs, })](https://dazl-dev.github.io/core3-utils/fs-utils.createimportpath) | Returns relative import path if imported and target files are in the same package, otherwise returns a bare import specifier.                        |
| [formatToOSpaths(str)](https://dazl-dev.github.io/core3-utils/fs-utils.formattoospaths)                                                                |                                                                                                                                                      |
| [getBareImportSpecifier(absoluteImportPath, packageJsonPath, packageJsonName)](https://dazl-dev.github.io/core3-utils/fs-utils.getbareimportspecifier) | Creates bare import specifier for an absolute import path, stripping extension from JS/TS files.                                                     |
| [getDTSPath(filePath)](https://dazl-dev.github.io/core3-utils/fs-utils.getdtspath)                                                                     |                                                                                                                                                      |
| [getFullExtname(filePath)](https://dazl-dev.github.io/core3-utils/fs-utils.getfullextname)                                                             | Returns file extension from the first occurrence of the ".", unlike path.extname() which returns from the last occurrence.                           |
| [getImportPath(filePath)](https://dazl-dev.github.io/core3-utils/fs-utils.getimportpath)                                                               |                                                                                                                                                      |
| [getPackageJsonPath(filePath, fs)](https://dazl-dev.github.io/core3-utils/fs-utils.getpackagejsonpath)                                                 | Gets path to package.json file closest to the given file path.                                                                                       |
| [getPackageName(dirPath, fs)](https://dazl-dev.github.io/core3-utils/fs-utils.getpackagename)                                                          | Gets package name.                                                                                                                                   |
| [getPackagePath(filePath, fs)](https://dazl-dev.github.io/core3-utils/fs-utils.getpackagepath)                                                         | Gets path to package directory, closest to the given file path.                                                                                      |
| [getRelativeImportPath(sourceFilePath, filePathToImport)](https://dazl-dev.github.io/core3-utils/fs-utils.getrelativeimportpath)                       | Creates relative import path for a file, stripping extension from JS/TS files.                                                                       |
| [getRelativeModulePath(sourceAbsFilePath, targetAbsFilePath)](https://dazl-dev.github.io/core3-utils/fs-utils.getrelativemodulepath)                   |                                                                                                                                                      |
| [isDirPath(filePath)](https://dazl-dev.github.io/core3-utils/fs-utils.isdirpath)                                                                       |                                                                                                                                                      |
| [isJavaScriptFile(filePath)](https://dazl-dev.github.io/core3-utils/fs-utils.isjavascriptfile)                                                         |                                                                                                                                                      |
| [isJsonFile(filePath)](https://dazl-dev.github.io/core3-utils/fs-utils.isjsonfile)                                                                     |                                                                                                                                                      |
| [isPathIncludesDir(filePath, directoryName)](https://dazl-dev.github.io/core3-utils/fs-utils.ispathincludesdir)                                        | Safely checks if a path contains a directory name.                                                                                                   |
| [isRelativeModulePath(path)](https://dazl-dev.github.io/core3-utils/fs-utils.isrelativemodulepath)                                                     |                                                                                                                                                      |
| [isRelativeModuleRequest(request)](https://dazl-dev.github.io/core3-utils/fs-utils.isrelativemodulerequest)                                            |                                                                                                                                                      |
| [isSubPath(path, basePath, fs)](https://dazl-dev.github.io/core3-utils/fs-utils.issubpath)                                                             | Checks if a path is equal to or subpath of a given base path.                                                                                        |
| [isTsOrJS(filePath)](https://dazl-dev.github.io/core3-utils/fs-utils.istsorjs)                                                                         |                                                                                                                                                      |
| [isTypeAffectingFileOrDir(filePath)](https://dazl-dev.github.io/core3-utils/fs-utils.istypeaffectingfileordir)                                         |                                                                                                                                                      |
| [isTypeScriptFile(filePath)](https://dazl-dev.github.io/core3-utils/fs-utils.istypescriptfile)                                                         |                                                                                                                                                      |
| [isWindowsStyleAbsolutePath(fsPath)](https://dazl-dev.github.io/core3-utils/fs-utils.iswindowsstyleabsolutepath)                                       |                                                                                                                                                      |
| [pathChainToRoot(currentPath)](https://dazl-dev.github.io/core3-utils/fs-utils.pathchaintoroot)                                                        |                                                                                                                                                      |
| [pathToTrueCase(fs, path)](https://dazl-dev.github.io/core3-utils/fs-utils.pathtotruecase)                                                             | Returns case-exact absolute form of the path, similar to fs.realpathSync.native() Trailing segments of the path that don't exist are left unchanged. |
| [readPackageJson(dirPath, fs)](https://dazl-dev.github.io/core3-utils/fs-utils.readpackagejson)                                                        | Read and parse a directory's package.json                                                                                                            |
| [rebaseRelativeModulePath(filePath, modulePath)](https://dazl-dev.github.io/core3-utils/fs-utils.rebaserelativemodulepath)                             |                                                                                                                                                      |
| [replaceWinSlashes(str)](https://dazl-dev.github.io/core3-utils/fs-utils.replacewinslashes)                                                            |                                                                                                                                                      |

## Interfaces

| Interface                                                                                                       | Description |
| --------------------------------------------------------------------------------------------------------------- | ----------- |
| [AdjustRelativeImportPathArgs](https://dazl-dev.github.io/core3-utils/fs-utils.adjustrelativeimportpathargs) |             |
| [CreateImportPathArgs](https://dazl-dev.github.io/core3-utils/fs-utils.createimportpathargs)                 |             |

## Variables

| Variable                                                                                  | Description                                          |
| ----------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| [fileRequestPrefix](https://dazl-dev.github.io/core3-utils/fs-utils.filerequestprefix) | prefix for file requests in Language server protocol |
