Couldnt find GitLab API to directly upload file without the need of encoding

I couldn’t find any Gitlab API which can directly upload a file in the repository, I need to integrate this API in my project.
The only API I could find was this :

POST /projects/:id/repository/files/:file_path

But in this I need to encode the file first and copy the encoded content in the request body, which takes more processing time and storage.
Is there any alternative way which I can use without encoding file and opening the encoded file to copy the content? which is totally not safe.