Skip to content

@pod-os/core


@pod-os/core / FileGateway

Class: FileGateway

Defined in: files/FileGateway.ts:13

Gateway for file-related operations on Solid Pods and the store.

Since

0.24.0

Constructors

Constructor

new FileGateway(store, fileFetcher): FileGateway

Defined in: files/FileGateway.ts:14

Parameters

store

Store

fileFetcher

FileFetcher

Returns

FileGateway

Methods

uploadAndLinkFile()

uploadAndLinkFile(thing, predicateUri, fileToUpload): ResultAsync\<NewFile, NetworkProblem | HttpProblem>

Defined in: files/FileGateway.ts:29

Uploads a file and associates it with a thing. The container is automatically derived from the thing's URI. Uses schema:image as the predicate.

Parameters

thing

Thing

The thing to add the file to

predicateUri

string

The URI of the predicate to use

fileToUpload

File

The file to upload

Returns

ResultAsync\<NewFile, NetworkProblem | HttpProblem>

Result with the uploaded metadata (url, name, contentType) or error