<commit_before>var fs = require('fs')
var File = require('./file')
var async = require('async')
var _ = require('lodash')
var Iconv = require('iconv').Iconv

var converters = {
  'ISO-8895-1': new Iconv('ISO-8895-1', 'UTF-8')
}

module.exports = {
  readHeader: function(path,callback) { 
    readID3v2(path,callback) 
  },


  decodeStringBuffer: function(buffer) {
    if(buffer[0] === 0x00 && buffer[1] !== 0x00) {
      return converters['ISO-8895-1'].convert(buffer.slice(1)).toString('utf8')
    } else {
      throw new Error("Unsupported buffer encoding: " + buffer.inspect())
    }
  }

  //TODO export functions
}


function TagData(file, version, flags, size, frames) {
  this.file = file        //File read from
  this.version = version  //version tuple {'major','minor'}
  this.flags = flags      //flags field from the header<commit_msg>Commented out iconv conversion, since it throws an error with windows<commit_after>var fs = require('fs')
var File = require('./file')
var async = require('async')
var _ = require('lodash')
var Iconv = require('iconv').Iconv

var converters = {
  //FIXME throws an error on windows (use different library?)
  //'ISO-8895-1': new Iconv('ISO-8895-1', 'UTF-8')
}

module.exports = {
  readHeader: function(path,callback) { 
    readID3v2(path,callback) 
  },

  //TODO function for decoding picture data from a buffer

  decodeStringBuffer: function(buffer) {
    if(buffer[0] === 0x00 && buffer[1] !== 0x00) {
      return converters['ISO-8895-1'].convert(buffer.slice(1)).toString('utf8')
    } else { //TODO support unicode encoding
      throw new Error("Unsupported buffer encoding: " + buffer.inspect())
    }
  }

  //TODO export functions
}


function TagData(file, version, flags, size, frames) {
  this.file = file        //File read from
  this.version = version  //version tuple {'major','minor'}
  this.flags = flags      //flags field from the header
{'fraction_non_alphanumeric': 0.15271966527196654, 'fraction_numerical': 0.029288702928870293, 'mean_word_length': 3.5656324582338903, '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': '4681895', 'n_tokens_mistral': 643, 'n_tokens_neox': 606, 'n_words': 161}