mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-23 02:08:30 +00:00
add golder-retriever docs
This commit is contained in:
parent
6ce298b426
commit
e489dc95a3
3 changed files with 69 additions and 5 deletions
45
website/src/docs/golder-retriever.md
Normal file
45
website/src/docs/golder-retriever.md
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
title: "Golden Retriever"
|
||||
type: docs
|
||||
permalink: docs/golden-retriever/
|
||||
order: 15
|
||||
---
|
||||
|
||||
Golden Retriever plugin saves selected files in your browser cache (Local Storage for metadata, then Service Worker for all blobs + IndexedDB for small blobs), so that if the browser crashes, Uppy can restore everything and continue uploading like nothing happened. Read more about it [on the blog](https://uppy.io/blog/2017/07/golden-retriever/).
|
||||
|
||||
1\. Bundle your own service worker `sw.js` file with Uppy Golden Retriever’s service worker. If you’re using Browserify, just bundle it separately, for Webpack there is a plugin [serviceworker-webpack-plugin](https://github.com/oliviertassinari/serviceworker-webpack-plugin).
|
||||
|
||||
```js
|
||||
// sw.js
|
||||
|
||||
require('uppy/lib/GoldenRetriever/ServiceWorker.js')
|
||||
```
|
||||
|
||||
2\. Register it in your app entry point:
|
||||
|
||||
```js
|
||||
// you app.js entry point
|
||||
|
||||
uppy.use(RestoreFiles, {serviceWorker: true})
|
||||
uppy.run()
|
||||
|
||||
const isServiceWorkerControllerReady = new Promise(resolve => {
|
||||
if (navigator.serviceWorker.controller) return resolve()
|
||||
navigator.serviceWorker.addEventListener('controllerchange', e => resolve())
|
||||
})
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker
|
||||
.register('/sw.js') // path to your bundled service worker with Golden Retriever service worker
|
||||
.then((registration) => {
|
||||
console.log('ServiceWorker registration successful with scope: ', registration.scope)
|
||||
return isServiceWorkerControllerReady
|
||||
})
|
||||
.then(() => {
|
||||
uppy.emit('core:file-sw-ready')
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('Registration failed with ' + error)
|
||||
})
|
||||
}
|
||||
```
|
||||
19
website/src/docs/tus.md
Normal file
19
website/src/docs/tus.md
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
order: 7
|
||||
title: "Tus"
|
||||
permalink: docs/tus/
|
||||
---
|
||||
|
||||
Tus plugin brings [tus.io](http://tus.io) resumable file uploading to Uppy by wrapping the [tus-js-client](https://github.com/tus/tus-js-client).
|
||||
|
||||
## Options
|
||||
|
||||
```js
|
||||
uppy.use(Tus10, {
|
||||
resume: true,
|
||||
allowPause: true,
|
||||
autoRetry: true,
|
||||
retryDelays: [0, 1000, 3000, 5000]
|
||||
})
|
||||
```
|
||||
|
||||
|
|
@ -33,12 +33,12 @@ Starts upload automatically after the first file is selected.
|
|||
|
||||
Optionally provide rules and conditions for which files can be selected.
|
||||
|
||||
#### Parameters
|
||||
**Parameters**
|
||||
|
||||
- **maxFileSize** *number*
|
||||
- **maxNumberOfFiles** *number*
|
||||
- **minNumberOfFiles** *number*
|
||||
- **allowedFileTypes** *array* of wildcards or exact mime types, like `image/*`
|
||||
- `maxFileSize` *number*
|
||||
- `maxNumberOfFiles` *number*
|
||||
- `minNumberOfFiles` *number*
|
||||
- `allowedFileTypes` *array* of wildcards or exact mime types, like `image/*`
|
||||
|
||||
### `meta: {}`
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue