@inrupt/solid-client / resource/resource

Module: resource/resource

Functions

getContentType

getContentType(resource: WithResourceInfo): 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:105


getPodOwner

getPodOwner(resource: WithServerResourceInfo): 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:139


getResourceInfo

getResourceInfo(url: UrlString, options?: Partial<typeof internal_defaultFetchOptions>): Promise<WithServerResourceInfo>

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

since 0.4.0

Parameters:

Name

Type

Default value

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:54


getSourceUrl

getSourceUrl(resource: WithResourceInfo): 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:113

getSourceUrl(resource: Resource): string | null

Parameters:

Name

Type

resource

Resource

Returns: string | null

Defined in: src/resource/resource.ts:114


isContainer

isContainer(resource: Url | UrlString | WithResourceInfo): boolean

Parameters:

Name

Type

Description

resource

Url | UrlString | WithResourceInfo

Resource for which to check whether it is a Container.

Returns: boolean

Whether resource is a Container.

Defined in: src/resource/resource.ts:82


isPodOwner

isPodOwner(webId: WebId, resource: WithServerResourceInfo): 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:166


isRawData

isRawData(resource: WithResourceInfo): 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:97