Closed Joycn2018 closed 5 years ago
Error: method only available in Node.js keythereum.min.js:1:10269 importFromFile http://localhost:3000/js/keythereum-master/dist/keythereum.min.js:1:10269 <匿名> http://localhost:3000/js/app.js:195:21 dispatch http://localhost:3000/js/jquery.min.js:4:8497 add/r.handle http://localhost:3000/js/jquery.min.js:4:5235
Why importing a key from geth's keystore can only be done on Node? If I want to implement this function in the browser, what should I do?
@Joycn2018 javascript in the browser is unable to access local file system (for obvious security reasons) so you can't create a keystore locally from the browser, it's just not possible.
Hi @Joycn2018, unfortunately @aleybovich is correct. If you want to achieve the same functionality in the browser, I recommend using the HTML5 file API -- see discussion in https://github.com/ethereumjs/keythereum/issues/6#issuecomment-192704432 for details!
I got an error "Error: method only available in Node.js", when I use a function named "keythereum.importFromFile()" by javascript. I ran successfully in node. But written in the JS file, it will prompt the error by opening the web page. My system is Ubuntu 16.04