class_docstr: A component for converting a text file to a Document.
  
  Usage example:
  ```python
  from haystack.components.converters.txt import TextFileToDocument
  
  converter = TextFileToDocument()
  results = converter.run(sources=["sample.txt"])
  documents = results["documents"]
  print(documents[0].content)
  # 'This is the content from the txt file.'
  ```
docstr: Create a TextFileToDocument component.
  
  :param encoding: The default encoding of the text files. Default: `"utf-8"`.
      Note that if the encoding is specified in the metadata of a ByteStream,
      it will override this default.
code: def __init__(self, encoding: str = "utf-8"):
      """
      Create a TextFileToDocument component.
  
      :param encoding: The default encoding of the text files. Default: `"utf-8"`.
          Note that if the encoding is specified in the metadata of a ByteStream,
          it will override this default.
      """
      self.encoding = encoding
  
file_path: haystack/haystack/components/converters/txt.py
imports: import logging
  from pathlib import Path
  from typing import List, Union, Dict, Any, Optional
  from haystack import Document, component
  from haystack.dataclasses import ByteStream
  from haystack.components.converters.utils import get_bytestream_from_source, normalize_metadata
label_desc: Use image node_id 1 to create a new TextFileToDocument object  with example: obj = TextFileToDocument(encoding)