How to use the kew.ncall function in kew

To help you get started, we’ve selected a few kew examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github volumio / Volumio2 / app / plugins / system_controller / networkfs / index.js View on Github external
var respShare = {
            path: config.get(key + '.path'),
            ip: config.get(key + '.ip'),
            name: config.get(key + '.name'),
            fstype: config.get(key + '.fstype'),
            username: config.get(key + '.user'),
            password: config.get(key + '.password'),
            options: config.get(key + '.options'),
            id: share,
            mounted: mounted.mounted,
            size: ''
        };
        var quotedmount = quotePath(mountpoint);
        // cmd returns size in bytes with no units and no header line
        var cmd="df -B1 --output=used " + quotedmount + " | tail -1";
        var promise = libQ.ncall(exec,respShare,cmd).then(function (stdout){


            var splitted=stdout.split('\n');
            var sizeStr=splitted[0];

            var size=parseInt(sizeStr) / 1024 / 1024;
            var unity = 'MB';
            if (size > 1024) {
                size = size / 1024;
                unity = 'GB';
                if (size > 1024) {
                    size = size / 1024;
                    unity = 'TB';
                }
            }
            respShare.size = size.toFixed(2) + " " + unity ;

kew

a lightweight promise library for node

Apache-2.0
Latest version published 9 years ago

Package Health Score

59 / 100
Full package analysis