<commit_before>'use strict';

var extend = require('deep-extend');
var ejs = require('ejs');
var isBinaryFile = require('isbinaryfile');

function render(contents, filename, context, tplSettings) {
  let result;

  if (isBinaryFile.sync(filename)) {
    result = contents.toString();
  } else {
    result = ejs.render(
      contents.toString(),
      context,
      // Setting filename by default allow including partials.
      extend({filename: filename}, tplSettings)
    );
  }

  return result;
}

module.exports = function (from, to, context, tplSettings, options) {
  context = context || {};

  this.copy(from, to, extend(options || {}, {<commit_msg>Prevent binary-files from being converted to utf-8<commit_after>'use strict';

var extend = require('deep-extend');
var ejs = require('ejs');
var isBinaryFile = require('isbinaryfile');

function render(contents, filename, context, tplSettings) {
  let result;

  if (isBinaryFile.sync(filename)) {
    result = Buffer.from(contents, 'binary');
  } else {
    result = ejs.render(
      contents.toString(),
      context,
      // Setting filename by default allow including partials.
      extend({filename: filename}, tplSettings)
    );
  }

  return result;
}

module.exports = function (from, to, context, tplSettings, options) {
  context = context || {};

  this.copy(from, to, extend(options || {}, {
{'fraction_non_alphanumeric': 0.13951789627465302, 'fraction_numerical': 0.0007304601899196494, 'mean_word_length': 3.823943661971831, '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': '1424337', 'n_tokens_mistral': 405, 'n_tokens_neox': 398, 'n_words': 109}