core3-utils

npm version @wixc3/fs-utils on Github

Home > @wixc3/fs-utils

fs-utils package

Functions

Function Description
[addRelativePrefix(path)](/core3-utils/fs-utils.addrelativeprefix.html)
[backSlash(str, type)](/core3-utils/fs-utils.backslash.html) Ensure a single heading/trailing backslash (/) of a single line string
[createImportPath({ importedFilePath, targetFilePath, targetPackageJsonPath, fs, })](/core3-utils/fs-utils.createimportpath.html) Returns relative import path if imported and target files are in the same package, otherwise returns a bare import specifier.
[formatToOSpaths(str)](/core3-utils/fs-utils.formattoospaths.html)
[getBareImportSpecifier(absoluteImportPath, packageJsonPath, packageJsonName)](/core3-utils/fs-utils.getbareimportspecifier.html) Creates bare import specifier for an absolute import path, stripping extension from JS/TS files.
[getDTSPath(filePath)](/core3-utils/fs-utils.getdtspath.html)
[getFullExtname(filePath)](/core3-utils/fs-utils.getfullextname.html) Returns file extension from the first occurrence of the ".", unlike path.extname() which returns from the last occurrence.
[getImportPath(filePath)](/core3-utils/fs-utils.getimportpath.html)
[getPackageJsonPath(filePath, fs)](/core3-utils/fs-utils.getpackagejsonpath.html) Gets path to package.json file closest to the given file path.
[getPackageName(dirPath, fs)](/core3-utils/fs-utils.getpackagename.html) Gets package name.
[getPackagePath(filePath, fs)](/core3-utils/fs-utils.getpackagepath.html) Gets path to package directory, closest to the given file path.
[getRelativeImportPath(sourceFilePath, filePathToImport)](/core3-utils/fs-utils.getrelativeimportpath.html) Creates relative import path for a file, stripping extension from JS/TS files.
[getRelativeModulePath(sourceAbsFilePath, targetAbsFilePath)](/core3-utils/fs-utils.getrelativemodulepath.html)
[isDirPath(filePath)](/core3-utils/fs-utils.isdirpath.html)
[isJavaScriptFile(filePath)](/core3-utils/fs-utils.isjavascriptfile.html)
[isJsonFile(filePath)](/core3-utils/fs-utils.isjsonfile.html)
[isPathIncludesDir(filePath, directoryName)](/core3-utils/fs-utils.ispathincludesdir.html) Safely checks if a path contains a directory name.
[isRelativeModulePath(path)](/core3-utils/fs-utils.isrelativemodulepath.html)
[isRelativeModuleRequest(request)](/core3-utils/fs-utils.isrelativemodulerequest.html)
[isSubPath(path, basePath, fs)](/core3-utils/fs-utils.issubpath.html) Checks if a path is equal to or subpath of a given base path.
[isTsOrJS(filePath)](/core3-utils/fs-utils.istsorjs.html)
[isTypeAffectingFileOrDir(filePath)](/core3-utils/fs-utils.istypeaffectingfileordir.html)
[isTypeScriptFile(filePath)](/core3-utils/fs-utils.istypescriptfile.html)
[isWindowsStyleAbsolutePath(fsPath)](/core3-utils/fs-utils.iswindowsstyleabsolutepath.html)
[pathChainToRoot(currentPath)](/core3-utils/fs-utils.pathchaintoroot.html)
[pathToTrueCase(fs, path)](/core3-utils/fs-utils.pathtotruecase.html) 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)](/core3-utils/fs-utils.readpackagejson.html) Read and parse a directory's package.json
[rebaseRelativeModulePath(filePath, modulePath)](/core3-utils/fs-utils.rebaserelativemodulepath.html)
[replaceWinSlashes(str)](/core3-utils/fs-utils.replacewinslashes.html)

Interfaces

Interface Description
[AdjustRelativeImportPathArgs](/core3-utils/fs-utils.adjustrelativeimportpathargs.html)
[CreateImportPathArgs](/core3-utils/fs-utils.createimportpathargs.html)

Variables

Variable Description
[fileRequestPrefix](/core3-utils/fs-utils.filerequestprefix.html) prefix for file requests in Language server protocol