You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
web3Interactive/reference/tools/demoLoadAccountKey.mjs

23 lines
531 B

import fs from 'fs/promises';
const filePath = './demoAccount.txt';
// 返回一个 Promise
async function loadData() {
try {
const data = await fs.readFile(filePath, 'utf8');
const privateKeyList = data.split('\n');
return privateKeyList;
} catch (err) {
console.error('读取文件时发生错误:', err);
process.exit(1);
}
}
// 调用 loadData 并等待结果
async function main() {
const privateKeyList = await loadData();
console.log(privateKeyList);
}
main();