node.js - node-webkit windows build where to store persistent data? -
i building desktop app node-webkit. have used nw-builder build windows 32 & windows 64 bit mac. program working fine in windows except files use store data gone upon program exit.
the app packed .pak file , assuming when program closed , files along erased. when start app again , persisted data gone.
how can persist data in windows node-webkit ?
i using 'node-persist' package persistence. in mac creating folder called 'persist' inside .app file , writing files works fine.
but in windows , due .pak file , persisted files lost when program closed. how fix ? there way to store files outside .pak. .pak seems extracted temp location.
update ( solved )
i have used app.datapath described in https://github.com/nwjs/nw.js/wiki/app
excerpt :
get application's data path in user's directory. windows: %localappdata%/; linux: ~/.config/; osx: ~/library/application support/ field in manifest.
popcorntime uses same in database.js file. https://git.popcorntime.io/popcorntime/desktop/blob/master/src/app/database.js
you have multiple options:
https://github.com/nwjs/nw.js/wiki/save-persistent-data-in-app
personally, used localstorage
. simple needs, it's easy , mimics browser behaviour.
Comments
Post a Comment