mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-25 19:23:55 +00:00
restore: Add indexedDB.expires option to configure expiry time.
This commit is contained in:
parent
2f14aa8a6e
commit
d940b4fa85
1 changed files with 3 additions and 2 deletions
|
|
@ -5,7 +5,7 @@ const isSupported = !!indexedDB
|
|||
|
||||
const DB_NAME = 'uppy-blobs'
|
||||
const STORE_NAME = 'files' // maybe have a thumbnail store in the future
|
||||
const DEFAULT_EXPIRY = 24 * 60 * 60 * 1000 // 1 day
|
||||
const DEFAULT_EXPIRY = 24 * 60 * 60 * 1000 // 24 hours
|
||||
const DB_VERSION = 3
|
||||
|
||||
// Set default `expires` dates on existing stored blobs.
|
||||
|
|
@ -66,6 +66,7 @@ class IndexedDBStore {
|
|||
this.opts = Object.assign({
|
||||
dbName: DB_NAME,
|
||||
storeName: 'default',
|
||||
expires: DEFAULT_EXPIRY, // 24 hours
|
||||
maxFileSize: 10 * 1024 * 1024, // 10 MB
|
||||
maxTotalSize: 300 * 1024 * 1024 // 300 MB
|
||||
}, opts)
|
||||
|
|
@ -170,7 +171,7 @@ class IndexedDBStore {
|
|||
id: this.key(file.id),
|
||||
fileID: file.id,
|
||||
store: this.name,
|
||||
expires: Date.now() + DEFAULT_EXPIRY,
|
||||
expires: Date.now() + this.opts.expires,
|
||||
data: file.data
|
||||
})
|
||||
return waitForRequest(request)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue