-
-
Notifications
You must be signed in to change notification settings - Fork 16
.import
localDataStorage.import( [mode] )
This method reads an exported JSON object. The overwrite mode is optional and, if specified, determines how existing data in the store will be affected by the import. When omitted, mode is defined by the value present in the export object.
The import mode can have one of two possible values:
safe - imported data cannot overwrite existing keys but will create new keys as necessary (identical to using softset)
unsafe - imported data will overwrite any keys with matching names and will also make new keys as necessary (identical to using set)
The import is only effective when the key prefix defined in the JSON object matches the prefix of the store in-use. You cannot import keys from a different namespaced store.
When importing data, existing keys may be overwritten. If this happens, a key's prior value cannot be retrieved.
EXAMPLES:
Import an eight-key JSON assigned as storageBackup-1 ensuring existing keys are preserved:
● localData.import( 'storageBackup-1', 'safe' )
--> Importing upto 8 keys from Sun May 29 2022 23:56:37 GMT-0400 (Eastern Daylight Time)...
--> One key imported
Import an eight-key JSON assigned as storageBackup-1 ensuring the export values are authoritative:
● localData.import( 'storageBackup-1', 'unsafe' )
--> Overwriting 8 keys from Sun May 29 2022 23:56:37 GMT-0400 (Eastern Daylight Time)...
--> 8 keys imported
🌐 This method may fire events allowing you to monitor key changes.
✨ The complement to this is export.
Array Keys:
push / pull, pullall poke contains where
Broadcasting:
broadcast
Data Transfer:
import / export
Duplicates:
countdupes, showdupes, listdupes
Internals:
cancrunch crunch / uncrunch
shufflestring / unshufflestring
Management:
keys
Memory Consumption:
Memory Quota:
showquota
Query:
haskey, hasval, hastype
setscramblekey / getscramblekey
Type Check:
isarray isbigint isboolean iscrunch
isdate isfloat isinteger isnull
Utility:
chopget copy softset rename
_set / _get _clear _key _remove
Management:
_keys
Type Check:
_isarray _isbigint _isboolean _iscrunch