Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
path-extra
Advanced tools
Readme
This module simply modifies the Node.js 'path' object with extra methods. It is a drop in replacement for the path
module.
$ npm install path-extra
var path = require('path-extra');
You can still use all of the vanilla Node.js path methods.
replaceExt(filePath, extension)
Replaces the extension from path with extension and returns the updated path string.
From the module replace-ext
.
Example:
path.replaceExt('dir/file.md', '.html')
// => 'dir/file.html'
normalizeTrim(filePath)
A path.normalize()
that trims trailing slashes. Useful for comparing file paths.
Example:
path.normalize('/foo/bar//baz/asdf/quux/../')
// => /foo/bar/baz/asdf/
path.normalizeTrim('/foo/bar//baz/asdf/quux/../')
// => /foo/bar/baz/asdf
base(filePath, [includeExt])
A smart wrapper for path.basename()
.
includeExt
is false
, returns the basename without an extension (path.basename(filePath, path.extname(filePath))
).includeExt
is true
, works like path.basename(filePath)
.includeExt
is false
by default.Example:
path.base('path/to/file.md')
// => file
path.base('path/to/file.md', false)
// => file
path.base('path/to/file.md', true)
// => file.md
removeExt(filepath)
Remove a path's extension.
Example:
path.removeExt('some/dir/file.ext')
// => some/dir/file
fileNameWithPostfix(filePath, postfix)
Append string to the end of the filename.
Example:
path.fileNameWithPostfix('path/to/file-name.ext', '-old')
// => path/to/file-name-old.ext
fileNameWithPrefix(filePath, prefix)
Append string to the beginning of the filename.
Example:
path.fileNameWithPrefix('path/to/file-name.ext', 'new-')
// => path/to/new-file-name.ext
homedir()
, tempdir()
, and datadir()
have been removed in version 4.0.0. Please use the ospath module instead.
(The MIT License)
Copyright (c) 2011-2015 JP Richardson
FAQs
path-extra contains methods that aren't included in the vanilla Node.js path package.
The npm package path-extra receives a total of 49,323 weekly downloads. As such, path-extra popularity was classified as popular.
We found that path-extra demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.