The path string this path refers to.
/home/user/file.txt
https://site.com/file.txt
Optional
filesystem: FilesystemProtected
Optional
Readonly
filesystemProtected
Readonly
initialThe path string this path refers to.
/home/user/file.txt
https://site.com/file.txt
Protected
resourceProtected
resourceProtected
resourceGet the charset of this resource.
Get the content-type header of this resource.
Get the extension of the resource referred to by this instance.
const myFile = universalPath('home', 'user', 'file.txt')
myFile.ext // => 'txt'
Returns true if this resource refers to a file on the local filesystem.
Returns true if this resource refers to a file on a remote filesystem.
Get the mime-type of this resource.
Get the string of this resource.
Get the URLSearchParams for this resource.
Get the basename of the path.
Get the path to this resource as it would be accessed from the current filesystem.
Get the fully-prefixed path to this resource.
Get the non-prefixed path to this resource.
Append the given path-like item to this resource's path.
Unlike concat
, this mutates the current instance.
Return a new copy of this UniversalPath instance.
Append and resolve the given paths to this resource and return a new UniversalPath.
const homeDir = universalPath('home', 'user')
homeDir.concat('file.txt').toLocal // => /home/user/file.txt
homeDir.concat('..', 'other_user').toLocal // => /home/other_user
Rest
...paths: PathLike[]Returns true if the given path refers to the same resource as this path.
Returns true if this path exists in the subtree of the given path.
Returns true if the given path exists in the subtree of this path.
List any immediate children of this resource.
Build and apply a pipeline.
Return a new Pipe of this collection.
Protected
setProtected
setRecursively walk all files in this directory. Must be a local resource.
This returns an async generator function.
const configFiles = universalPath('home', 'user', '.config')
for await (const configFile of configFiles.walk()) {
// configFile is a string
// ... do something ...
}
Class representing some kind of filesystem resource.