<commit_before>var blocktrail = require('blocktrail-sdk');
var crypto = require('crypto');
var backupGenerator = require('blocktrail-sdk/lib/backup_generator');

var fs = require('fs');

var client = blocktrail({
    apiKey : "MY_APIKEY",
    apiSecret : "MY_APISECRET",
    testnet : true
});

//create a new wallet
var walletIdentifier = "nodejs-example-" + crypto.randomBytes(24).toString('hex');
client.createNewWallet(walletIdentifier, "example-strong-password", 9999, function(err, wallet, primaryMnemonic, backupMnemonic, blocktrailPubKeys) {
    if (err) {
        return console.log("createNewWallet ERR", err);
    }

    //console.log('primary mnemonic', primaryMnemonic);
    //console.log('backup mnemonic', backupMnemonic);
    //console.log('blocktrail pubkeys', blocktrailPubKeys);

    //generate the backup document
    var backup = new backupGenerator(primaryMnemonic, backupMnemonic, blocktrailPubKeys);
    var result = backup.generateHTML();

    fs.writeFile("examples/my-wallet-backup.html", result, function(err) {
        if(err) {
            console.log(err);
        } else {
            console.log("The file was saved!");
        }
    });
    console.log();
});<commit_msg>generate pdf, html and image<commit_after>var blocktrail = require('blocktrail-sdk');
var crypto = require('crypto');
var backupGenerator = require('blocktrail-sdk/lib/backup_generator');

var fs = require('fs');
var path = require('path');

var LIBPATH = path.normalize(__dirname + '/..');

var client = blocktrail({
    apiKey : "MY_APIKEY",
    apiSecret : "MY_APISECRET",
    testnet : true
});

//create a new wallet
var walletIdentifier = "nodejs-example-" + crypto.randomBytes(24).toString('hex');
client.createNewWallet(walletIdentifier, "example-strong-password", 9999, function(err, wallet, primaryMnemonic, backupMnemonic, blocktrailPubKeys) {
    if (err) {
        return console.log("createNewWallet ERR", err);
    }

    //generate the backup document as a pdf
    var backup = new backupGenerator(primaryMnemonic, backupMnemonic, blocktrailPubKeys);
    //pdf
    backup.generatePDF(LIBPATH + "/examples/my-wallet-backup.pdf", function (result) {
        console.log(result);
    });

    //can also be html, an image, or plain text
    var result = backup.generateHTML();
     fs.writeFile(LIBPATH + "/examples/my-wallet-backup.html", result, function(err) {
         if(err) {
            console.log(err);
         } else {
            console.log("The file was saved!");
         }
     });



    //image (png)
    backup.generateImage(LIBPATH + "/examples/my-wallet-backup.png", function (result) {
        console.log(result);
    });

});
{'fraction_non_alphanumeric': 0.14280359820089955, 'fraction_numerical': 0.004497751124437781, 'mean_word_length': 3.523728813559322, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4530364', 'n_tokens_mistral': 834, 'n_tokens_neox': 805, 'n_words': 178}