Skip to content

Commit

Permalink
Add docs for onDownloadProgress
Browse files Browse the repository at this point in the history
  • Loading branch information
perry-mitchell committed Jan 11, 2022
1 parent 08e75a2 commit 1dfe112
Show file tree
Hide file tree
Showing 3 changed files with 10,314 additions and 10 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,23 @@ Specify the `maxContentLength` option to alter the maximum number of bytes the c

_`options` extends [method options](#method-options)._

##### Download progress

You can calculate the progress of the download by using `onDownloadProgress`:

```typescript
import { ProgressEvent } from "webdav";

await client.getFileContents("/package.zip", {
onDownloadProgress: (progressEvent: ProgressEvent) => {
// {
// total: 12345600,
// loaded: 54023
// }
}
});
```

#### getFileDownloadLink

Generate a public link where a file can be downloaded. This method is synchronous. **Exposes authentication details in the URL**.
Expand Down Expand Up @@ -580,6 +597,7 @@ Most WebDAV methods extend `WebDAVMethodOptions`, which allow setting things lik
|-------------------|-----------|-----------------------------------------------|
| `data` | No | Optional body/data value to send in the request. This overrides the original body of the request, if applicable. |
| `headers` | No | Optional headers object to apply to the request. These headers override all others, so be careful. |
| `signal` | No | Instance of [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal), for aborting requests. |

### Common data structures

Expand Down
Loading

0 comments on commit 1dfe112

Please sign in to comment.