Git Product home page Git Product logo

redux-persist-node-storage's People

Contributors

dabit1 avatar pellejacobs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

redux-persist-node-storage's Issues

Add an open source license

@pellejacobs Thanks for sharing this project! We have added your library in the Mattermost redux https://github.com/mattermost/mattermost-redux/blob/master/package.json#L37.

Would you consider adding the MIT license as a LICENSE file?

If you use a license it would make it easy to add your work to other open source projects, and we'd love to keep your work in ours.

Thanks kindly for your consideration and let me know if you have any questions!

Please see more context here: mattermost/mattermost-redux#1179 (review).

Promise based api

redux-persist just switched to requiring promise based storage in v5.0.0-beta.13

Unfortunately it is going to be a pain to get everyone updated. Technically the storage can support both (like AsyncStorage and localforage) but since this module is specific to redux-persist may was well just go 100% promises and make the peer dep be redux-persist@5

TypeError: Cannot read property 'slice' of undefined when importing in NativeScript

If I import the library (in NativeScript) like it says in the docs: import { AsyncNodeStorage } from 'redux-persist-node-storage'
I get the following error: TypeError: Cannot read property 'slice' of undefined when importing

UPDATE:
This is because of how the NativeScript environment is setup, read my comment below for explanation

Cannot resolve module fs in

I get this error as soon as I try to import AsynchNewStorage:

How do I fix this?

ERROR in ./~/node-localstorage/LocalStorage.js
Module not found: Error: Cannot resolve module 'fs' in /home/simran/Desktop/frontend/node_modules/node-localstorage
 @ ./~/node-localstorage/LocalStorage.js 9:7-20
ERROR in ./~/graceful-fs/graceful-fs.js
Module not found: Error: Cannot resolve module 'fs' in /home/simran/Desktop/frontend/node_modules/graceful-fs
 @ ./~/graceful-fs/graceful-fs.js 1:9-22
ERROR in ./~/graceful-fs/fs.js
Module not found: Error: Cannot resolve module 'fs' in /home/simran/Desktop/frontend/node_modules/graceful-fs
 @ ./~/graceful-fs/fs.js 3:9-22

Is reading and writing "fully" asynchronous?

From my reading of the code, it seems like it's not. For example, in index.ts

  getItem (key: string) {
    return new Promise<string>((resolve, reject) => {
      try {
        const storedValue = this.localStorage.getItem(key)
        process.nextTick(() => resolve(storedValue))
      } catch (e) {
        reject(e)
      }
    })
  }

localStorage.getItem() is called in the body of the resolver function, which the MDN says is executed immediately. I believe this means the calling thread is blocked by localStorage.getItem(). I understand all "asynchronous" code blocks the calling thread to some extent, but it might be helpful to clarify somewhere that reading/writing is using the blocking sync API.

Thank you for writing this project, and thank you for your time!

Using in electron with webpack

Thanks for this awesome module. I am trying to use this in electron.

When I try to though I get this error:

I am using from the "main" process, not a "renderer", I normally can use fs from here without a problem.

fs.statSync is not a function

I installed redux-persist-node-storage and use the example, but a have problem: TypeError: fs.statSync is not a function

LocalStorage.prototype._init = function() {
var _MetaKey, _decodedKey, _keys, e, error, error1, i, index, k, len, stat;
try {
stat = fs.statSync(this._location); //the problem
if ((stat != null) && !stat.isDirectory()) {
throw new Error("A file exists at the location '" + this._location + "' when trying to create/open localStorage");
}
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.