<commit_before>function createDataObj(buffer, headers) {
    return {
        headers: headers || "text/plain"
      , buffer: buffer
    };
}

var ToBuffer = module.exports = function (data) {

    if (data === undefined) {
        return createDataObj(new Buffer(0));
    }

    if (typeof data === 'string') {
        return createDataObj(new Buffer(data));
    }

    if (data instanceof Buffer) {
        return createDataObj(data);
    }

    if (data instanceof Error) {
        data = createDataObj(data.toString());
    }

    try {
        data = JSON.stringify(data);
        createDataObj(data, "application/json; charset=utf-8");
    } catch (err) {
        return createDataObj(new Buffer(0));
    }

    if (data === undefined) {
        return createDataObj(new Buffer(0));
    }

    return createDataObj(new Buffer(data));
};
<commit_msg>Default mime type is html<commit_after>function createDataObj(buffer, headers) {
    return {
        headers: headers || "html"
      , buffer: buffer
    };
}

var ToBuffer = module.exports = function (data) {

    if (data === undefined) {
        return createDataObj(new Buffer(0));
    }

    if (typeof data === 'string') {
        return createDataObj(new Buffer(data));
    }

    if (data instanceof Buffer) {
        return createDataObj(data);
    }

    if (data instanceof Error) {
        data = createDataObj(data.toString());
    }

    try {
        data = JSON.stringify(data);
        createDataObj(data, "application/json; charset=utf-8");
    } catch (err) {
        return createDataObj(new Buffer(0));
    }

    if (data === undefined) {
        return createDataObj(new Buffer(0));
    }

    return createDataObj(new Buffer(data));
};

{'fraction_non_alphanumeric': 0.13213038416763678, 'fraction_numerical': 0.004656577415599534, 'mean_word_length': 2.4939024390243905, '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': '2707907', 'n_tokens_mistral': 518, 'n_tokens_neox': 501, 'n_words': 122}