document Resource

This commit is contained in:
cswimr 2025-02-09 10:10:56 -06:00
parent bd5d747a72
commit 566bc90aab
Signed by: cswimr
GPG key ID: 0EC431A8DA8F8087
4 changed files with 94 additions and 20 deletions

View file

@ -1,7 +0,0 @@
[**packwizjs**](../README.md)
***
[packwizjs](../modules.md) / index
# index

View file

@ -8,7 +8,6 @@
- [enums/hash-format](enums/hash-format/README.md)
- [enums/side](enums/side/README.md)
- [index](index/README.md)
- [parser](parser/README.md)
- [provider](provider/README.md)
- [resource](resource/README.md)

View file

@ -6,7 +6,9 @@
# Class: Resource
Defined in: resource.ts:5
Defined in: resource.ts:8
Resource class for handling file and URL paths.
## Constructors
@ -14,7 +16,9 @@ Defined in: resource.ts:5
> **new Resource**(`path`): [`Resource`](Resource.md)
Defined in: resource.ts:6
Defined in: resource.ts:13
Creates a new Resource instance.
#### Parameters
@ -22,6 +26,8 @@ Defined in: resource.ts:6
`string`
The file or URL path.
#### Returns
[`Resource`](Resource.md)
@ -32,7 +38,9 @@ Defined in: resource.ts:6
> `readonly` **path**: `string`
Defined in: resource.ts:6
Defined in: resource.ts:13
The file or URL path.
## Accessors
@ -42,12 +50,16 @@ Defined in: resource.ts:6
> **get** **ext**(): `string`
Defined in: resource.ts:36
Defined in: resource.ts:63
Gets the file extension of the file or URL.
##### Returns
`string`
The file extension of the file or URL.
***
### isUrl
@ -56,12 +68,16 @@ Defined in: resource.ts:36
> **get** **isUrl**(): `boolean`
Defined in: resource.ts:12
Defined in: resource.ts:27
Checks if the path is a valid URL.
##### Returns
`boolean`
True if the path is a valid URL, false otherwise.
***
### name
@ -70,12 +86,16 @@ Defined in: resource.ts:12
> **get** **name**(): `string`
Defined in: resource.ts:21
Defined in: resource.ts:40
Gets the name of the file or URL.
##### Returns
`string`
The name of the file or URL.
***
### parent
@ -84,43 +104,57 @@ Defined in: resource.ts:21
> **get** **parent**(): [`Resource`](Resource.md)
Defined in: resource.ts:27
Defined in: resource.ts:50
Gets the parent directory of the file or URL.
##### Returns
[`Resource`](Resource.md)
The parent directory of the file or URL.
## Methods
### exists()
> **exists**(): `Promise`\<`boolean`\>
Defined in: resource.ts:42
Defined in: resource.ts:73
Checks if the file or URL exists.
#### Returns
`Promise`\<`boolean`\>
True if the file or URL exists, false otherwise.
***
### fetchContents()
> **fetchContents**(): `Promise`\<`string`\>
Defined in: resource.ts:52
Defined in: resource.ts:87
Fetches the contents of the file or URL.
#### Returns
`Promise`\<`string`\>
The contents of file the Resource points to.
***
### join()
> **join**(...`segments`): [`Resource`](Resource.md)
Defined in: resource.ts:62
Defined in: resource.ts:102
Joins the Resource with other segments to create a new Resource.
#### Parameters
@ -128,18 +162,26 @@ Defined in: resource.ts:62
...`string`[]
The segments to join with the Resource.
#### Returns
[`Resource`](Resource.md)
A new Resource instance with the joined path.
***
### toString()
> **toString**(): `string`
Defined in: resource.ts:8
Defined in: resource.ts:19
Returns the string representation of the Resource instance.
#### Returns
`string`
The path of the Resource.