Socket
Socket
Sign inDemoInstall

@wixc3/fs-utils

Package Overview
Dependencies
Maintainers
69
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wixc3/fs-utils

Filesystem utils, usable in all environments


Version published
Weekly downloads
926
increased by3.58%
Maintainers
69
Weekly downloads
 
Created
Source

npm version @wixc3/fs-utils on Github

Home > @wixc3/fs-utils

fs-utils package

Functions

FunctionDescription
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.
getBareImportSpecifier(absoluteImportPath, packageJsonPath, packageJsonName)Creates bare import specifier for an absolute import path, stripping extension from JS/TS files.
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)
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.
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)

Interfaces

InterfaceDescription
AdjustRelativeImportPathArgs
CreateImportPathArgs

Variables

VariableDescription
fileRequestPrefixprefix for file requests in Language server protocol
formatToOSpaths
getDTSPath
isDirPath
isJavaScriptFile
isJsonFile
isTsOrJS
isTypeAffectingFileOrDir
isTypeScriptFile
replaceWinSlashes

FAQs

Package last updated on 06 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc