Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions plugins/upload/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,17 @@ import { upload, HttpMethod } from '@tauri-apps/plugin-upload'
upload(
'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
(progressTotal, total) =>
console.log(`Uploaded ${progressTotal} of ${total} bytes`), // a callback that will be called with the upload progress
{ 'Content-Type': 'text/plain' } // optional headers to send with the request
)

// Upload with specific HTTP method
upload(
'https://example.com/file-upload',
'./path/to/my/file.txt',
(progress, total) => console.log(`Uploaded ${progress} of ${total} bytes`),
(progressTotal, total) =>
console.log(`Uploaded ${progressTotal} of ${total} bytes`),
{ 'Content-Type': 'text/plain' },
HttpMethod.Put // Use HttpMethod enum - supports POST, PUT, PATCH
)
Expand All @@ -86,7 +88,8 @@ import { download } from '@tauri-apps/plugin-upload'
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
(progressTotal, total) =>
console.log(`Downloaded ${progressTotal} of ${total} bytes`), // a callback that will be called with the download progress
{ 'Content-Type': 'text/plain' } // optional headers to send with the request
)
```
Expand Down