public File getRawFile(Object projectIdOrPath, String commitOrBranchName, String filepath, File directory) throws GitLabApiException {

        InputStream in = getRawFile(projectIdOrPath, commitOrBranchName, filepath);

        try {

            if (directory == null) {
                directory = new File(System.getProperty("java.io.tmpdir"));
            }

            String filename = new File(filepath).getName();
            File file = new File(directory, filename);

            Files.copy(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
            return (file);

        } catch (IOException ioe) {
            throw new GitLabApiException(ioe);
        } finally {
            try {
                in.close();
            } catch (IOException ignore) {
            }
        }
    }
public File getRawFile ( Object projectIdOrPath , String commitOrBranchName , String filepath , File directory ) throws GitLabApiException { InputStream in = getRawFile ( projectIdOrPath , commitOrBranchName , filepath ) ; try { if ( directory == null ) { directory = new File ( System . getProperty ( "java.io.tmpdir" ) ) ; } String filename = new File ( filepath ) . getName ( ) ; File file = new File ( directory , filename ) ; Files . copy ( in , file . toPath ( ) , StandardCopyOption . REPLACE_EXISTING ) ; return ( file ) ; } catch ( IOException ioe ) { throw new GitLabApiException ( ioe ) ; } finally { try { in . close ( ) ; } catch ( IOException ignore ) { } } }
Get the raw file for the file by commit sha and path. Thye file will be saved to the specified directory.
If the file already exists in the directory it will be overwritten.

V3:
<pre><code>GitLab Endpoint: GET /projects/:id/repository/blobs/:sha</code></pre>

V4:
<pre><code>GitLab Endpoint: GET /projects/:id/repository/files/:filepath</code></pre>

@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param commitOrBranchName the commit or branch name to get the file for
@param filepath the path of the file to get
@param directory the File instance of the directory to save the file to, if null will use "java.io.tmpdir"
@return a File instance pointing to the download of the specified file
@throws GitLabApiException if any exception occurs