(self, filepath, delimiter=',')
Add a CSV, JSONL or a PLASO file to the buffer.

        Args:
            filepath: the path to the file to add.
            delimiter: if this is a CSV file then a delimiter can be defined.

        Raises:
            TypeError: if the entry does not fulfill requirements.
Add a CSV, JSONL or a PLASO file to the buffer.
Add a CSV JSONL or a PLASO file to the buffer .
def add_file(self, filepath, delimiter=','):
        """Add a CSV, JSONL or a PLASO file to the buffer.

        Args:
            filepath: the path to the file to add.
            delimiter: if this is a CSV file then a delimiter can be defined.

        Raises:
            TypeError: if the entry does not fulfill requirements.
        """
        self._ready()

        if not os.path.isfile(filepath):
            raise TypeError('Entry object needs to be a file that exists.')

        if not self._timeline_name:
            base_path = os.path.basename(filepath)
            default_timeline_name, _, _ = base_path.rpartition('.')
            self.set_timeline_name(default_timeline_name)

        file_ending = filepath.lower().split('.')[-1]

        if not self._data_label:
            self._data_label = file_ending

        if file_ending == 'csv':
            if self._csv_delimiter:
                delimiter = self._csv_delimiter

            with codecs.open(
                    filepath, 'r', encoding=self._text_encoding,
                    errors='replace') as fh:
                for chunk_frame in pandas.read_csv(
                        fh, delimiter=delimiter,
                        chunksize=self._threshold_entry):
                    self.add_data_frame(chunk_frame, part_of_iter=True)
        elif file_ending == 'plaso':
            self._upload_binary_file(filepath)

        elif file_ending == 'jsonl':
            with codecs.open(
                    filepath, 'r', encoding=self._text_encoding,
                    errors='replace') as fh:
                for line in fh:
                    try:
                        self.add_json(line.strip())
                    except TypeError as e:
                        logger.error('Unable to decode line: {0!s}'.format(e))

        else:
            raise TypeError(
                'File needs to have a file extension of: .csv, .jsonl or '
                '.plaso')
def add_file ( self , filepath , delimiter = ',' ) : self . _ready ( ) if not os . path . isfile ( filepath ) : raise TypeError ( 'Entry object needs to be a file that exists.' ) if not self . _timeline_name : base_path = os . path . basename ( filepath ) default_timeline_name , _ , _ = base_path . rpartition ( '.' ) self . set_timeline_name ( default_timeline_name ) file_ending = filepath . lower ( ) . split ( '.' ) [ - 1 ] if not self . _data_label : self . _data_label = file_ending if file_ending == 'csv' : if self . _csv_delimiter : delimiter = self . _csv_delimiter with codecs . open ( filepath , 'r' , encoding = self . _text_encoding , errors = 'replace' ) as fh : for chunk_frame in pandas . read_csv ( fh , delimiter = delimiter , chunksize = self . _threshold_entry ) : self . add_data_frame ( chunk_frame , part_of_iter = True ) elif file_ending == 'plaso' : self . _upload_binary_file ( filepath ) elif file_ending == 'jsonl' : with codecs . open ( filepath , 'r' , encoding = self . _text_encoding , errors = 'replace' ) as fh : for line in fh : try : self . add_json ( line . strip ( ) ) except TypeError as e : logger . error ( 'Unable to decode line: {0!s}' . format ( e ) ) else : raise TypeError ( 'File needs to have a file extension of: .csv, .jsonl or ' '.plaso' )