mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-06 13:53:54 +02:00
Merge remote-tracking branch 'origin/v1' into v2
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||

|
||||
|
||||
Upload files from disk to a remote server over HTTP.
|
||||
Download files from a remote HTTP server to disk.
|
||||
|
||||
## Install
|
||||
|
||||
@@ -63,10 +64,21 @@ Afterwards all the plugin's APIs are available through the JavaScript guest bind
|
||||
import { upload } from '@tauri-apps/plugin-upload'
|
||||
|
||||
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
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user