@wixc3/fs-utils
TypeScript icon, indicating that this package has built-in type declarations

17.1.1 • Public • Published

npm version @wixc3/fs-utils on Github

Home > @wixc3/fs-utils

fs-utils package

Functions

Function Description
addRelativePrefix(path)
backSlash(str, type) Ensure a single heading/trailing backslash (/) of a single line string
createImportPath({ importedFilePath, targetFilePath, targetPackageJsonPath, fs, }) Returns relative import path if imported and target files are in the same package, otherwise returns a bare import specifier.
formatToOSpaths(str)
getBareImportSpecifier(absoluteImportPath, packageJsonPath, packageJsonName) Creates bare import specifier for an absolute import path, stripping extension from JS/TS files.
getDTSPath(filePath)
getFullExtname(filePath) Returns file extension from the first occurrence of the ".", unlike path.extname() which returns from the last occurrence.
getImportPath(filePath)
getPackageJsonPath(filePath, fs) Gets path to package.json file closest to the given file path.
getPackageName(dirPath, fs) Gets package name.
getPackagePath(filePath, fs) Gets path to package directory, closest to the given file path.
getRelativeImportPath(sourceFilePath, filePathToImport) Creates relative import path for a file, stripping extension from JS/TS files.
getRelativeModulePath(sourceAbsFilePath, targetAbsFilePath)
isDirPath(filePath)
isJavaScriptFile(filePath)
isJsonFile(filePath)
isPathIncludesDir(filePath, directoryName) Safely checks if a path contains a directory name.
isRelativeModulePath(path)
isRelativeModuleRequest(request)
isSubPath(path, basePath, fs) Checks if a path is equal to or subpath of a given base path.
isTsOrJS(filePath)
isTypeAffectingFileOrDir(filePath)
isTypeScriptFile(filePath)
isWindowsStyleAbsolutePath(fsPath)
pathChainToRoot(currentPath)
pathToTrueCase(fs, path) 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) Read and parse a directory's package.json
rebaseRelativeModulePath(filePath, modulePath)
replaceWinSlashes(str)

Interfaces

Interface Description
AdjustRelativeImportPathArgs
CreateImportPathArgs

Variables

Variable Description
fileRequestPrefix prefix for file requests in Language server protocol

Readme

Keywords

none

Package Sidebar

Install

npm i @wixc3/fs-utils

Weekly Downloads

226

Version

17.1.1

License

MIT

Unpacked Size

116 kB

Total Files

51

Last publish

Collaborators

  • dorza
  • vladba-wix
  • danielgovrin
  • yurimorkovnik
  • ranberko91
  • 0xrezaa
  • gregdamsky
  • alissawix
  • ekaterinaza
  • noammu
  • buchenpilar
  • oleksiiletushev
  • alisalachman
  • vladyslav-baliuk
  • yuriin
  • ilyakwix
  • matang
  • daomry
  • noama
  • shakederin
  • dlvhdr
  • plisovyi
  • pijusn
  • shireewill
  • haryelp
  • iuriikowix
  • itaywix
  • thealmightycrumb
  • devex-infra
  • olehr
  • tomrav
  • avi.vahl
  • alexswix
  • omerk
  • talga
  • cijoe
  • wix-ci
  • wixnpm
  • baraki
  • interal
  • alisey
  • danieleww
  • idoros
  • nadavwix
  • rashellek
  • wtfil
  • denysdovhan
  • vkobeliatskyi
  • pistolpete_
  • nettaru
  • igalh
  • netanelgilad
  • anatfenn
  • erezshasha
  • zemlanin
  • arnonkehat
  • ariki
  • itpurchases
  • danalevy
  • serhiiz
  • oleksandraab
  • idango10
  • mikanadel
  • tetiana0611
  • vladkar
  • yurii-v
  • elig-wix
  • nadav.a
  • vladyslavgoloshchapov