You can try a simple parseFloat:

const balance = parseFloat(data);

Just make sure you get an actual number.

On Sunday, June 18, 2017 at 7:12:46 AM UTC+2, Woukaine Beyond wrote:
>
> Hi,
>
> I use this script for get my bitcoin balance : 
>
> app.get('/GET/MY/BITCOIN/BALANCE', function (req, res) {
> if( isConnected(req) == true)
> {
> var child = exec('cd /home/rpcdaemon/wallets/bitcoin-0.14.1/bin; 
> ./bitcoin-cli getbalance ' + req.params.account, {async:true});
> child.stdout.on('data', function(data) {
> var bitcoin_balance = data;
> res.send({"success":true, bitcoin_balance:bitcoin_balance});
> });
> }
> });
>
> the variable "bitcoin_balance" == 0.00000 but return 0.00000\n to my 
> json...
>
> How to fix it ? Thx !
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/78d2a968-11b2-4cf9-bb86-04dce51df497%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to