Search code examples
node.jspersist

Node-persist : initSync is not a function


I have just started learning Nodejs.
And i'm learning about persist module. Here my code:

var storage = require('node-persist');
// console.log(storage);
storage.initSync();

But i met this error

TypeError: storage.initSync is not a function

And when console.log storage, it has only create and init

{ create: [Function], init: [Function] }

Does my code wrong somewhere?


Solution

  • You should check the 3.0.0 change log

    All the *Sync functions were removed, every operation is now asynchronous

    https://www.npmjs.com/package/node-persist#300-change-logs