How to use fmt - 10 common examples

To help you get started, we’ve selected a few fmt 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 chilts / node-awssum-scripts / amazon / s3-sync-up.js View on Github external
emitter.on('end', function() {
        // console.log('Entire directory has been walked.');
        fmt.field('WalkingDir', 'Finished');
    });
});
github chilts / awssum / examples / amazon / sts / get-session-token.js View on Github external
var accessKeyId     = env.ACCESS_KEY_ID;
var secretAccessKey = env.SECRET_ACCESS_KEY;
var awsAccountId    = env.AWS_ACCOUNT_ID;

var sts = new Sts({
    'accessKeyId'     : accessKeyId,
    'secretAccessKey' : secretAccessKey,
    // 'awsAccountId'    : awsAccountId, // optional
    'region'          : amazon.US_EAST_1
});

fmt.field('Region', sts.region() );
fmt.field('EndPoint', sts.host() );
fmt.field('AccessKeyId', sts.accessKeyId().substr(0, 3) + '...' );
fmt.field('SecretAccessKey', sts.secretAccessKey().substr(0, 3) + '...' );
fmt.field('AwsAccountId', sts.awsAccountId() );

sts.GetSessionToken(function(err, data) {
    fmt.msg("gettting a session token - expecting success");
    fmt.dump(err, 'Error');
    fmt.dump(data, 'Data');
});
github chilts / node-awssum-scripts / lib / amazon-s3-common.js View on Github external
function doRequest(marker) {
        var options = {
            BucketName : bucketname,
        };
        if ( marker ) {
            options.Marker = marker;
        }

        fmt.field('Request', options.Marker || '[start]');
        s3.ListObjects(options, function(err, data) {
            if (err) {
                callback(err, null);
                return;
            }

            fmt.field('Items', data.Body.ListBucketResult.Contents.length);

            // loop through all the items and add them on to our saved list
            data.Body.ListBucketResult.Contents.forEach(function(v, i) {
                // ignore all .dotfiles
                if ( v.Key.substr(0, 1) === '.' ) {
                    fmt.field('IgnoringDotObject', v.Key);
                    return;
                }
github chilts / node-awssum-scripts / amazon / s3-upload.js View on Github external
fs.stat(item.filename, function(err, stats) {
        if ( err ) {
            // this file doesn't exist so we can't upload it
            fmt.field('FileNotExist', item.filename);
            callback();
            return;
        }

        // we know there is a file
        item.size = stats.size;

        // add it to the upload queue
        uploadItemQueue.push(item);
        callback();
    });
}
github chilts / node-awssum-scripts / lib / amazon-s3-common.js View on Github external
data.Body.ListBucketResult.Contents.forEach(function(v, i) {
                // ignore all .dotfiles
                if ( v.Key.substr(0, 1) === '.' ) {
                    fmt.field('IgnoringDotObject', v.Key);
                    return;
                }

                // remove the extra "" around the MD5
                v.ETag = v.ETag.substr(1, 32);

                // convert the size to a number
                v.Size = parseInt(v.Size, 10);

                // now push onto the array
                items.push(v);
            });
github chilts / node-awssum-scripts / amazon / s3-sync-down.js View on Github external
objects.forEach(function(item, i) {
        // ignore any keys that look like directories (the ones that the Amazon AWS Console creates)
        if ( item.Size === 0 && item.Key.charAt(item.Key.length-1) === '/' ) {
            fmt.field('IgnoringDirKey', item.Key);
            return;
        }

        checkItemIsLocalQueue.push(item);
    });
github chilts / awssum / examples / amazon / sts / get-session-token.js View on Github external
sts.GetSessionToken(function(err, data) {
    fmt.msg("gettting a session token - expecting success");
    fmt.dump(err, 'Error');
    fmt.dump(data, 'Data');
});
github chilts / awssum / examples / amazon / s3 / get-object-metadata.js View on Github external
s3.GetObjectMetadata(options, function(err, data) {
    fmt.msg("getting an object from pie-18 - expecting success");
    fmt.dump(err, 'Error');
    fmt.dump(data, 'Data');
});
github chilts / awssum / examples / amazon / sqs / add-permission.js View on Github external
sqs.AddPermission(options, function(err, data) {
    fmt.msg("Adding a set of Policies to this queue - expecting failure (for many reasons)");
    fmt.dump(err, 'Error');
    fmt.dump(data, 'Data');
});
github chilts / awssum / examples / amazon / s3 / complete-multipart-upload.js View on Github external
s3.CompleteMultipartUpload(options, function(err, data) {
    fmt.msg("completing upload - expecting failure (no such upload)");
    fmt.dump(err, 'Error');
    fmt.dump(data, 'Data');
});

fmt

Command line output formatting.

MIT
Latest version published 4 years ago

Package Health Score

45 / 100
Full package analysis

Popular fmt functions