<commit_before>import alt from "alt-instance";
import iDB from "idb-instance";
import {compress, decompress} from "lzma";
import {PrivateKey, PublicKey, Aes, key} from "bitsharesjs";
import WalletActions from "actions/WalletActions";

class BackupActions {
    incommingWebFile(file) {
        return dispatch => {
            let reader = new FileReader();
            reader.onload = evt => {
                let contents = new Buffer(evt.target.result, "binary");
                let name = file.name;
                let last_modified = file.lastModifiedDate.toString();

                dispatch({name, contents, last_modified});
            };
            reader.readAsBinaryString(file);
        };
    }

    incommingBuffer(params) {
        return params;
    }

    reset() {
        return true;
    }
}

let BackupActionsWrapped = alt.createActions(BackupActions);
export default BackupActionsWrapped;

export function backup(backup_pubkey) {
    return new Promise(resolve => {
        resolve(
            createWalletObject().then(wallet_object => {
                let compression = 1;
                return createWalletBackup(
                    backup_pubkey,<commit_msg>Close #1125: Fix use of undefined date property (#1941)<commit_after>import alt from "alt-instance";
import iDB from "idb-instance";
import {compress, decompress} from "lzma";
import {PrivateKey, PublicKey, Aes, key} from "bitsharesjs";
import WalletActions from "actions/WalletActions";

class BackupActions {
    incommingWebFile(file) {
        return dispatch => {
            let reader = new FileReader();
            reader.onload = evt => {
                let contents = new Buffer(evt.target.result, "binary");
                let name = file.name;

                let last_modified = new Date(file.lastModified).toString();

                dispatch({name, contents, last_modified});
            };
            reader.readAsBinaryString(file);
        };
    }

    incommingBuffer(params) {
        return params;
    }

    reset() {
        return true;
    }
}

let BackupActionsWrapped = alt.createActions(BackupActions);
export default BackupActionsWrapped;

export function backup(backup_pubkey) {
    return new Promise(resolve => {
        resolve(
            createWalletObject().then(wallet_object => {
                let compression = 1;
                return createWalletBackup(
                    backup_pubkey,
{'fraction_non_alphanumeric': 0.09741060419235512, 'fraction_numerical': 0.004110152075626798, 'mean_word_length': 2.3025780189959293, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '5774324', 'n_tokens_mistral': 661, 'n_tokens_neox': 646, 'n_words': 160}