src/utils/wallet.js
/**
 * Load wallet from given path on HDD and offer it as download to user. Calls back with error
 * that is suitable to be shown to the user.
 * @param walletPath
 * @param callback
 */
Load wallet from given path on HDD and offer it as download to user. Calls back with error
that is suitable to be shown to the user.
@param walletPath
@param callback
Load wallet from given path on HDD and offer it as download to user . Calls back with error that is suitable to be shown to the user . @param walletPath @param callback
function downloadWallet(walletPath, callback) {
    fs.readFile(walletPath, (err, fd) => {
        if (err) {
            console.error(err);
            return callback(new Error(`Failed to download wallet from ${walletPath}: ${err.message}`));
        }
        const date = Date.now();
        fileDownload(fd, `${date}_${WALLET_FILENAME}`);
        return callback(null, fd);
    });
}
function downloadWallet ( walletPath , callback ) { fs . readFile ( walletPath , ( err , fd ) => { if ( err ) { console . error ( err ) ; return callback ( new Error ( ` ${ walletPath } ${ err . message } ` ) ) ; } const date = Date . now ( ) ; fileDownload ( fd , ` ${ date } ${ WALLET_FILENAME } ` ) ; return callback ( null , fd ) ; } ) ; }
Load wallet from given path on HDD and offer it as download to user.
Load wallet from given path on HDD and offer it as download to user .