docs(upload): documentation for download function (#362)

* feat: documentation for download func.

* fix: linguitic and header type changes
This commit is contained in:
Vinayak
2023-05-17 19:07:18 +05:30
committed by GitHub
parent 40e3624f37
commit 5c05224e42
+16 -4
View File
@@ -1,6 +1,7 @@
![plugin-upload](banner.png)
Upload files from disk to a remote server over HTTP.
Download files from a remote HTTP server to disk.
## Install
@@ -54,10 +55,21 @@ Afterwards all the plugin's APIs are available through the JavaScript guest bind
import { upload } from 'tauri-plugin-upload-api'
upload(
'https://example.com/file-upload'
'./path/to/my/file.txt'
(progress, total) => console.log(`Downloaded ${progress} of ${total} bytes`) // a callback that will be called with the upload progress
{ 'ContentType': 'text/plain' } // optional headers to send with the request
'https://example.com/file-upload',
'./path/to/my/file.txt',
(progress, total) => console.log(`Uploaded ${progress} of ${total} bytes`), // a callback that will be called with the upload progress
{ 'Content-Type': 'text/plain' } // optional headers to send with the request
)
```
```javascript
import { download } from "tauri-plugin-upload-api";
download(
'https://example.com/file-download-link',
'./path/to/save/my/file.txt',
(progress, total) => console.log(`Downloaded ${progress} of ${total} bytes`), // a callback that will be called with the download progress
{ 'Content-Type': 'text/plain' } // optional headers to send with the request
)
```