@inrupt/solid-client / resource/resource

# Module: resource/resource¶

## Functions¶

### getContentType¶

getContentType(resource): string | null

#### Parameters¶

Name

Type

Description

resource

WithResourceInfo

Resource for which to determine the Content Type.

#### Returns¶

string | null

The Content Type, if known, or null if not known.

#### Defined in¶

src/resource/resource.ts:121

### getEffectiveAccess¶

getEffectiveAccess(resource): EffectiveAccess

Get what access the current user has to the given Resource.

This function can tell you what access the current user has for the given Resource, allowing you to e.g. determine that changes to it will be rejected before attempting to do so. Additionally, for servers adhering to the Web Access Control specification, it will tell you what access unauthenticated users have to the given Resource.

since 1.7.0

#### Parameters¶

Name

Type

Description

resource

WithServerResourceInfo

A Resource fetched from a Solid Pod.

#### Returns¶

EffectiveAccess

What access the current user and, if supported by the server, unauthenticated users have to the given Resource.

#### Defined in¶

src/resource/resource.ts:225

### getLinkedResourceUrlAll¶

getLinkedResourceUrlAll(resource): LinkedResourceUrlAll

Get the URLs of Resources linked to the given Resource.

Solid servers can link Resources to each other. For example, in servers implementing Web Access Control, Resources can have an Access Control List Resource linked to it via the acl relation.

since 1.7.0

#### Parameters¶

Name

Type

Description

resource

WithServerResourceInfo

A Resource fetched from a Solid Pod.

#### Returns¶

LinkedResourceUrlAll

The URLs of Resources linked to the given Resource, indexed by the key that links them.

#### Defined in¶

src/resource/resource.ts:206

### getPodOwner¶

getPodOwner(resource): WebId | null

Given a Resource that exposes information about the owner of the Pod it is in, returns the WebID of that owner.

Data about the owner of the Pod is exposed when the following conditions hold:

• The Pod server supports exposing the Pod owner

• The current user is allowed to see who the Pod owner is.

If one or more of those conditions are false, this function will return null.

since 0.6.0

#### Parameters¶

Name

Type

Description

resource

WithServerResourceInfo

A Resource that contains information about the owner of the Pod it is in.

#### Returns¶

WebId | null

The WebID of the owner of the Pod the Resource is in, if provided, or null if not.

#### Defined in¶

src/resource/resource.ts:155

### getResourceInfo¶

getResourceInfo(url, options?): Promise<WithServerResourceInfo>

Retrieve the information about a resource (e.g. access permissions) without fetching the resource itself.

since 0.4.0

#### Parameters¶

Name

Type

Description

url

UrlString

URL to fetch Resource metadata from.

options

Partial<typeof internal_defaultFetchOptions>

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

#### Returns¶

Promise<WithServerResourceInfo>

Promise resolving to the metadata describing the given Resource, or rejecting if fetching it failed.

#### Defined in¶

src/resource/resource.ts:57

### getSourceUrl¶

getSourceUrl(resource): string

#### Parameters¶

Name

Type

resource

WithResourceInfo

#### Returns¶

string

The URL from which the Resource has been fetched, or null if it is not known.

#### Defined in¶

src/resource/resource.ts:129

getSourceUrl(resource): string | null

#### Parameters¶

Name

Type

resource

Resource

#### Returns¶

string | null

#### Defined in¶

src/resource/resource.ts:130

### isContainer¶

isContainer(resource): boolean

#### Parameters¶

Name

Type

Description

resource

Resource for which to check whether it is a Container.

#### Returns¶

boolean

Whether resource is a Container.

#### Defined in¶

src/resource/resource.ts:98

### isPodOwner¶

isPodOwner(webId, resource): boolean | null

Given a WebID and a Resource that exposes information about the owner of the Pod it is in, returns whether the given WebID is the owner of the Pod.

Data about the owner of the Pod is exposed when the following conditions hold:

• The Pod server supports exposing the Pod owner

• The current user is allowed to see who the Pod owner is.

If one or more of those conditions are false, this function will return null.

since 0.6.0

#### Parameters¶

Name

Type

Description

webId

WebId

The WebID of which to check whether it is the Pod Owner’s.

resource

WithServerResourceInfo

A Resource that contains information about the owner of the Pod it is in.

#### Returns¶

boolean | null

Whether the given WebID is the Pod Owner’s, if the Pod Owner is exposed, or null if it is not exposed.

#### Defined in¶

src/resource/resource.ts:182

### isRawData¶

isRawData(resource): boolean

This function will tell you whether a given Resource contains raw data, or a SolidDataset.

#### Parameters¶

Name

Type

Description

resource

WithResourceInfo

Resource for which to check whether it contains raw data.

#### Returns¶

boolean

Whether resource contains raw data.

#### Defined in¶

src/resource/resource.ts:113