@igor.dvlpr/unc-path
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

UNC Path


🥽 Provides ways of parsing UNC paths and checking whether they are valid. 🎱


UNC Path




💖 Support further development

I work hard for every project, including this one and your support means a lot to me!
Consider buying me a coffee. ☕
Thank you for supporting my efforts! 🙏😊


Donate to igorskyflyer

@igorskyflyer



🕵🏼 Usage

Install it by executing:

npm i "@igor.dvlpr/unc-path"

🤹🏼 API

isValid() => returns whether the given path is a UNC one.


Signature

isValid(path): boolean

Parameters

path: string // a string that represents the path to process

Example

import { isValid } from '@igor.dvlpr/unc-path'

console.log(isValid('//ComputerName/SharedFolder/')) // returns true
console.log(isValid('//ComputerName/SharedFolder/file.mp4')) // returns true
console.log(isValid('/ComputerName/SharedFolder/')) // returns false


parse() => parses the provided UNC path and returns UNC path's components as

{
	'server': string,
	'resource': string
}

Signature

parse(path): Object

Parameters

path: string // a string that represents the path to process

Example

import { parse } from '@igor.dvlpr/unc-path'

console.log(parse('//Server/Dev/file.js'))
/*
returns {
      		server: 'Server',
        	resource: '/Dev/file.js',
      	}
*/

console.log(parse('/Server/Dev/file.js'))
/*
returns {
      		server: '',
       		resource: '',
      	}
*/

🪪 License

Licensed under the MIT license which is available here, MIT license.


🧬 Related

@igor.dvlpr/encode-entities

🏃‍♂️ Fast and simple Map and RegExp based HTML entities encoder. 🍁

@igor.dvlpr/regkeys

📚 An NPM package for fetching Windows registry keys. 🗝

@igor.dvlpr/upath

🎍 Provides a universal way of formatting file-paths in Unix-like and Windows operating systems as an alternative to the built-in path.normalize(). 🧬

@igor.dvlpr/is-rootdir

🔼 Provides a way to check if the given path is the root drive/directory. ⛔

@igor.dvlpr/valid-path

🧰 Provides ways of testing whether a given value can be a valid file/directory name. 🏜



Provided by Igor Dimitrijević (@igorskyflyer).

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.0.01latest

Version History

VersionDownloads (Last 7 Days)Published
3.0.01
2.1.23
2.1.10
2.1.00
2.0.00
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i @igor.dvlpr/unc-path

Weekly Downloads

4

Version

3.0.0

License

MIT

Unpacked Size

7.02 kB

Total Files

5

Last publish

Collaborators

  • igor.dvlpr