Open abel30567 opened 6 years ago
yes, I encountered the same thing.
just need to have it play more in line with the how CLI works:
const path = require('path');
const fs = require('fs');
const osenv = require('osenv');
const home = osenv.home();
const smidgen = require('smidgen');
const parsed = {};
parsed.smidgenconf = path.join(home, '.smidgenrc');
if (!fs.existsSync(parsed.smidgenconf)) {
fs.writeFileSync(
parsed.smidgenconf,
'{"provider": "http://iota.bitfinex.com:80"}',
);
}
const conf = {json: true};
smidgen.load(parsed, (err, smidgen) => {
smidgen.commands['generate-seed'](smidgen.iota, conf, (err, res) => {
console.log(res);
});
});
I tried to generate a seed using the code that is in the documentation example and I'm getting the following error
fs.js:358 binding.open(pathModule._makeLong(path), ^
TypeError: path must be a string or Buffer at Object.fs.readFile (fs.js:358:11) at fs.readdir (.../node_modules/smidgen/lib/smidgen.js:46:8) at FSReqWrap.oncomplete (fs.js:135:15)