https://github.com/igorskyflyer/npm-unc-path
π₯½ Provides ways of parsing UNC paths and checking whether they are valid. π±
https://github.com/igorskyflyer/npm-unc-path
back-end biome filesystem igorskyflyer javascript node nodejs npm parser path typescript unc vitest
Last synced: about 2 months ago
JSON representation
π₯½ Provides ways of parsing UNC paths and checking whether they are valid. π±
- Host: GitHub
- URL: https://github.com/igorskyflyer/npm-unc-path
- Owner: igorskyflyer
- License: mit
- Created: 2021-06-26T19:15:07.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-04T18:39:23.000Z (over 1 year ago)
- Last Synced: 2025-06-29T20:03:00.548Z (3 months ago)
- Topics: back-end, biome, filesystem, igorskyflyer, javascript, node, nodejs, npm, parser, path, typescript, unc, vitest
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@igor.dvlpr/unc-path
- Size: 221 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# UNC Path
π₯½ Provides ways of parsing UNC paths and checking whether they are valid. π±
![]()
π 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! ππ
![]()
@igorskyflyer
## π΅πΌ Usage
Install it by executing:
```shell
npm i "@igor.dvlpr/unc-path"
```
## π€ΉπΌ API
`isValid()` `=>` returns whether the given path is a UNC one.
Signature
```ts
isValid(path): boolean
```
Parameters
```ts
path: string // a string that represents the path to process
```
#### Example
```ts
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
```ts
{
'server': string,
'resource': string
}
```
Signature
```ts
parse(path): Object
```
Parameters
```ts
path: string // a string that represents the path to process
```
#### Example
```ts
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](https://github.com/igorskyflyer/npm-unc-path/blob/main/LICENSE).
---
## 𧬠Related
[@igor.dvlpr/encode-entities](https://www.npmjs.com/package/@igor.dvlpr/encode-entities)
> _πββοΈ Fast and simple Map and RegExp based HTML entities encoder. π_
[@igor.dvlpr/regkeys](https://www.npmjs.com/package/@igor.dvlpr/regkeys)
> _π An NPM package for fetching Windows registry keys. π_
[@igor.dvlpr/upath](https://www.npmjs.com/package/@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](https://www.npmjs.com/package/@igor.dvlpr/is-rootdir)
> _πΌ Provides a way to check if the given path is the root drive/directory. β_
[@igor.dvlpr/valid-path](https://www.npmjs.com/package/@igor.dvlpr/valid-path)
> _π§° Provides ways of testing whether a given value can be a valid file/directory name. π_
>
> Provided by **Igor DimitrijeviΔ** ([*@igorskyflyer*](https://github.com/igorskyflyer/)).
>