Socket
Book a DemoInstallSign in
Socket

@dazl/fs-utils

Package Overview
Dependencies
Maintainers
5
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dazl/fs-utils

Filesystem utils, usable in all environments

18.4.1
latest
Source
npmnpm
Version published
Weekly downloads
46
Maintainers
5
Weekly downloads
 
Created
Source

npm version @dazl/fs-utils on Github

Home > @dazl/fs-utils

fs-utils package

Functions

FunctionDescription
addRelativePrefix(path)
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

InterfaceDescription
AdjustRelativeImportPathArgs
CreateImportPathArgs

Variables

VariableDescription
fileRequestPrefixprefix for file requests in Language server protocol

FAQs

Package last updated on 27 Aug 2025

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.