> For the complete documentation index, see [llms.txt](https://wiki.4thtech.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.4thtech.io/sdk/storage/remote-storage-provider.md).

# Remote Storage Provider

A Remote Storage Provider is an abstract class representing a provider for remote storage functionalities. This class is intended to be extended by a specific implementation of a remote storage provider. It offers methods to upload and download files, as well as the ability to monitor upload progress.

### Usage

Below is a demonstration of extending the `RemoteStorageProvider` class for a custom implementation. You'll need to provide the actual logic for the `upload` and `download` methods based on your specific remote storage solution.

```ts
import type { FileInput } from '@4thtech-sdk/types';
import { RemoteStorageProvider } from '@4thtech-sdk/storage';

class MyRemoteStorageProvider extends RemoteStorageProvider {
  public async upload(file: FileInput, fileName: string): Promise<string> {
    // TODO: Implement the logic to upload the file to your storage.

    // Emitting the upload progress (for demonstration, assuming 100% here).
    this.emitUploadProgress(100, fileName);

    // Replace with the actual uploaded file URL.
    const uploadedFileUrl = 'https://your-storage.com/path-to-uploaded-file';
    return uploadedFileUrl;
  }

  public async download(url: string): Promise<ArrayBuffer> {
    // TODO: Implement the logic to download the file from your storage.

    // Replace with the actual file content.
    const fileContent = new ArrayBuffer(0);
    return fileContent;
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://wiki.4thtech.io/sdk/storage/remote-storage-provider.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
