> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# fetchResource

APISummary
`LynxEngine` internally calls this method to obtain the general resource content, and the return result is required to be the resource content `byte[]` type.

## Syntax

### Android

```java
public abstract void fetchResource(
    LynxResourceRequest request, LynxResourceCallback<byte[]> callback);
```

#### Parameters

- `request`: Request for the requiring resource.
- `callback`: Contents of the requiring resource.

:::note

- This method must be implemented.

:::

### iOS

```objc
- (dispatch_block_t)fetchResource:(nonnull LynxResourceRequest *)request
                       onComplete:(LynxGenericResourceCompletionBlock _Nonnull)callback;
```

#### Parameters

- `request`: Request for the requiring resource.
- `callback`: Contents of the requiring resource.

:::note

- This method must be implemented.

:::

### Harmony

```typescript
abstract fetchResource(request: LynxResourceRequest, callback: AsyncCallback<ArrayBuffer>): void;
```

#### Parameters

- `request`: Request to obtain the general resource content.
- `callback`: Containing contents of the requiring resource.

### Desktop (C++)

```cpp
virtual void FetchResource(std::shared_ptr<lynx::pub::LynxResourceRequest> request,
                           std::shared_ptr<lynx::pub::LynxResourceResponse> response);
```

#### Parameters

- `request`: Request for the resource being fetched.
- `response`: Response object to be populated by the host.

## Compatibility

**Compatibility Table**

**Query:** `lynx-native-api.lynx-generic-resource-fetcher.fetch-resource`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/lynx-native-api/lynx-generic-resource-fetcher/fetch-resource.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| fetch-resource | Yes (2.8) | Yes (3.4) | Yes (2.8) | Yes (3.7) | Yes (3.7) | No |

**`fetch-resource`**

LynxEngine internally calls this method to obtain the general resource content, and the return result is required to be the resource content byte[] type.

**Specifications:**

