:doc:`CodeCommit <../../codecommit>` / Client / get_file

********
get_file
********



.. py:method:: CodeCommit.Client.get_file(**kwargs)

  

  Returns the base-64 encoded contents of a specified file and its metadata.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/codecommit-2015-04-13/GetFile>`_  


  **Request Syntax**
  ::

    response = client.get_file(
        repositoryName='string',
        commitSpecifier='string',
        filePath='string'
    )
    
  :type repositoryName: string
  :param repositoryName: **[REQUIRED]** 

    The name of the repository that contains the file.

    

  
  :type commitSpecifier: string
  :param commitSpecifier: 

    The fully quaified reference that identifies the commit that contains the file. For example, you can specify a full commit ID, a tag, a branch name, or a reference such as refs/heads/main. If none is provided, the head commit is used.

    

  
  :type filePath: string
  :param filePath: **[REQUIRED]** 

    The fully qualified path to the file, including the full name and extension of the file. For example, /examples/file.md is the fully qualified path to a file named file.md in a folder named examples.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'commitId': 'string',
          'blobId': 'string',
          'filePath': 'string',
          'fileMode': 'EXECUTABLE'|'NORMAL'|'SYMLINK',
          'fileSize': 123,
          'fileContent': b'bytes'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **commitId** *(string) --* 

        The full commit ID of the commit that contains the content returned by GetFile.

        
      

      - **blobId** *(string) --* 

        The blob ID of the object that represents the file content.

        
      

      - **filePath** *(string) --* 

        The fully qualified path to the specified file. Returns the name and extension of the file.

        
      

      - **fileMode** *(string) --* 

        The extrapolated file mode permissions of the blob. Valid values include strings such as EXECUTABLE and not numeric values.

         

        .. note::

          

          The file mode permissions returned by this API are not the standard file mode permission values, such as 100644, but rather extrapolated values. See the supported return values.

          

        
      

      - **fileSize** *(integer) --* 

        The size of the contents of the file, in bytes.

        
      

      - **fileContent** *(bytes) --* 

        The base-64 encoded binary data object that represents the content of the file.

        
  
  **Exceptions**
  
  *   :py:class:`CodeCommit.Client.exceptions.RepositoryNameRequiredException`

  
  *   :py:class:`CodeCommit.Client.exceptions.InvalidRepositoryNameException`

  
  *   :py:class:`CodeCommit.Client.exceptions.RepositoryDoesNotExistException`

  
  *   :py:class:`CodeCommit.Client.exceptions.InvalidCommitException`

  
  *   :py:class:`CodeCommit.Client.exceptions.CommitDoesNotExistException`

  
  *   :py:class:`CodeCommit.Client.exceptions.PathRequiredException`

  
  *   :py:class:`CodeCommit.Client.exceptions.InvalidPathException`

  
  *   :py:class:`CodeCommit.Client.exceptions.FileDoesNotExistException`

  
  *   :py:class:`CodeCommit.Client.exceptions.EncryptionIntegrityChecksFailedException`

  
  *   :py:class:`CodeCommit.Client.exceptions.EncryptionKeyAccessDeniedException`

  
  *   :py:class:`CodeCommit.Client.exceptions.EncryptionKeyDisabledException`

  
  *   :py:class:`CodeCommit.Client.exceptions.EncryptionKeyNotFoundException`

  
  *   :py:class:`CodeCommit.Client.exceptions.EncryptionKeyUnavailableException`

  
  *   :py:class:`CodeCommit.Client.exceptions.FileTooLargeException`

  