sunnylqm / react-native-storage

local storage wrapper for both react-native and browser. Support size controlling, auto expiring, remote data auto syncing and getting batch data in one query.
MIT License
3.02k stars 268 forks source link

Can it hold big object? #184

Closed ichsarut closed 6 years ago

ichsarut commented 6 years ago

I tried to save object ( 2.56 mb ) but seem like store can not hold that data. it is fine for small one.

loadData = async () => {
    try {
      const response = await fetch(URL, {
        method: 'GET',
        headers: {
          Authorization: APIKEY
        }
      });
      return await response.json();
    } catch (e) {
      console.log(e);
    }
  };
    await this.setupStorage();
    const json = await this.loadData();
    console.log('got it', json);

    try {
      console.log('saving');
      storage.save({
        key: 'subdistricts',
        data: json
      });
      const subdistricts = await storage.load({
        key: 'subdistricts'
      });
      console.log('subdist', subdistricts);
    } catch (e) {
      console.error(e);
    }

screen shot 2018-07-17 at 14 13 15

sunnylqm commented 6 years ago

I suggest something like https://github.com/itinance/react-native-fs to store large data