hunk.code_window:       >
           <svg aria-hidden="true" class="uppy-c-icon" width="24" height="24" viewBox="0 0 24 24">
             <path d="M0 0h24v24H0z" fill="none" />
             <path d="M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z" />
           </svg>
         </button>
       )
     }
  
hunk.labels: keep replace replace replace keep keep keep keep keep
hunk.after_edit:         <svg aria-hidden="true" class="uppy-c-icon" height="24" viewBox="0 0 24 24" width="24">
             <path d="M0 0h24v24H0V0z" fill="none" />
             <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" />
             <path d="M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z" />
  
hunk.file_path: packages/@uppy/image-editor/src/Editor.js
hunk.type: replace
file: ---
  title: "Golden Retriever"
  module: "@uppy/golden-retriever"
  type: docs
  permalink: docs/golden-retriever/
  order: 1
  category: "Miscellaneous"
  tagline: "restore files and continue uploading after a page refresh or a browser crash"
  ---
  
  The `@uppy/golden-retriever` plugin saves selected files in your browser cache, so that if the browser crashes, Uppy can restore everything and continue uploading as if nothing happened. You can read more about it [on our blog](https://uppy.io/blog/2017/07/golden-retriever/).
  
  The Golden Retriever uses LocalStorage to store file metadata and Uppy state, and IndexedDB for small files. It also uses a Service Worker for _all_ files because, unlike IndexedDB, a Service Worker can keep very large files. Service Worker storage is _very_ temporary though, and doesn't persist across browser crashes or restarts. It works very well, however, for accidental refreshes or closed tabs.
  
  ## Installation
  
  This plugin is published as the `@uppy/golden-retriever` package.
  
  Install from NPM:
  
  ```shell
  npm install @uppy/golden-retriever
  ```
  
  In the [CDN package](/docs/#With-a-script-tag), it is available on the `Uppy` global object:
  
  ```js
  const GoldenRetriever = Uppy.GoldenRetriever
  ```
  
  ## Usage
  
  1\. Bundle your own service worker `sw.js` file with Uppy GoldenRetriever’s service worker. If you are 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/golden-retriever/lib/ServiceWorker')
  ```
  
  2\. Register it in your app entry point:
  
  ```js
  // you app.js entry point
  const GoldenRetriever = require('@uppy/golden-retriever')
  
  uppy.use(GoldenRetriever, {serviceWorker: true})
  
  if ('serviceWorker' in navigator) {
    navigator.serviceWorker
      .register('/sw.js') // path to your bundled service worker with GoldenRetriever service worker
      .then((registration) => {
        console.log('ServiceWorker registration successful with scope: ', registration.scope)
      })
      .catch((error) => {
        console.log('Registration failed with ' + error)
      })
  }
  ```
  
  Voilà, that’s it. Happy retrieving!
  