# downloadApi

用于下载文件

# Usage

```vue
<template>
  <a-button @click="download">下载文件</a-button>
</template>
<script setup lang="ts">
  import { downloadApi } from '@eciol/api';
  import { downloadData } from '@eciol/shared';
  import type { DownloadFileParams } from '@eciol/types';

  const download = async () => {
    const params: DownloadFileParams = {
      id: 'xxxx',
    };
    // 伪代码，上传文件
    const blob = await downloadApi(params);
    downloadData(blob, '文件名.doc');
  }
</script>
```

# API参数

```ts
interface DownloadFileParams {
    id: string;
}

declare namespace UploadService {
    interface FileItemResult {
        id: string;
        name: string;
        url: string;
        size: number;
    }
    interface UploadApiResult {
        results: FileItemResult[];
        total: number;
    }
    type DownloadApiResult = Blob;
    interface GetFileListParams {
        fileids: string;
    }
}

declare const downloadApi: (params: DownloadFileParams) => Promise<Blob>;
```
