Skip to content

@pod-os/core


@pod-os/core / FileFetcher

Class: FileFetcher

Defined in: files/FileFetcher.ts:20

Handles HTTP operations for files, like fetching and updating file contents.

Constructors

Constructor

new FileFetcher(session): FileFetcher

Defined in: files/FileFetcher.ts:21

Parameters

session

PodOsSession

Returns

FileFetcher

Methods

createNewFile()

createNewFile(container, name): ResultAsync\<NewFile, NotCreated>

Defined in: files/FileFetcher.ts:57

Parameters

container

LdpContainer

name

string | File

Returns

ResultAsync\<NewFile, NotCreated>


createNewFolder()

createNewFolder(container, name): ResultAsync\<NewFolder, NotCreated>

Defined in: files/FileFetcher.ts:91

Parameters

container

LdpContainer

name

string

Returns

ResultAsync\<NewFolder, NotCreated>


fetchFile()

fetchFile(url): Promise\<SolidFile>

Defined in: files/FileFetcher.ts:28

Fetch the contents of the given file

Parameters

url

string

URL identifying the file

Returns

Promise\<SolidFile>

An object representing the fetched file


putFile()

putFile(file, newContent): Promise\<Response>

Defined in: files/FileFetcher.ts:47

Updates the contents of a file (overrides old content with the given one)

Parameters

file

SolidFile

The file to update

newContent

string

The content to put into the file, overriding all existing

Returns

Promise\<Response>

The HTTP response