ethereumjs/keythereum

Error: method only available in Node.js,

Joycn2018 opened this issue · 4 comments

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

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 #6 (comment) for details!