<commit_before>import fs from 'fs';

export default class Media {

  static get IMAGE_FILE_EXTENSIONS() {
    return ['jpg', 'jpeg', 'png', 'gif'];
  }

  static build(filePath) {
    const buffer = fs.readFileSync(filePath);
    const extension = filePath.split('.').pop();
    // Media.IMAGE_FILE_EXTENSIONS.includes(extension)
    return new Media(buffer, extension);
  }

  constructor(buffer, extension, id = null ) {
    this.buffer = buffer;
    this.extension = extension;
    this.id = id;
  }

  toBase64() {
    return this.buffer.toString('base64')
  }

  /**
   * @param {string} mediaId<commit_msg>Implement appendsAdditionalMedia to Media model<commit_after>import fs from 'fs';

export default class Media {

  static appendsAdditionalMedia(currentMedias) {
    return currentMedias.length < 4;
  }

  static get IMAGE_FILE_EXTENSIONS() {
    return ['jpg', 'jpeg', 'png', 'gif'];
  }

  static build(filePath) {
    const buffer = fs.readFileSync(filePath);
    const extension = filePath.split('.').pop();
    // Media.IMAGE_FILE_EXTENSIONS.includes(extension)
    return new Media(buffer, extension);
  }

  constructor(buffer, extension, id = null ) {
    this.buffer = buffer;
    this.extension = extension;
    this.id = id;
  }

  toBase64() {
    return this.buffer.toString('base64')
  }

  /**
   * @param {string} mediaId
{'fraction_non_alphanumeric': 0.1356560415122313, 'fraction_numerical': 0.006671608598962194, 'mean_word_length': 3.4554455445544554, 'pattern_counts': {'":': 0, '<': 4, '<?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': '7643755', 'n_tokens_mistral': 449, 'n_tokens_neox': 425, 'n_words': 98}