An open API service indexing awesome lists of open source software.

https://github.com/vishwagauravin/trigger-download-file-pro

It helps you to actually trigger download of any file available on any server, and avoiding opening of the file in browser.
https://github.com/vishwagauravin/trigger-download-file-pro

download download-file download-photos download-songs download-videos downloader file-downloader javascript nextjs react reactjs trigger-events

Last synced: about 2 months ago
JSON representation

It helps you to actually trigger download of any file available on any server, and avoiding opening of the file in browser.

Awesome Lists containing this project

README

          

# trigger-download-file-pro
It helps you to actually trigger download of any file available on any server, and avoiding opening of the file in browser.

# How to Use ?
There are 2 ways to use it
## First:
Just create anchor tag `` and provide link in this format
`https://triggerdownload.herokuapp.com/api/download?url=YOUR_URL&filename=FILE_NAME&format=FILE_FORMAT`
#### **Required Parameters**
`url` = Your download URL
`filename` = File Name for Downloaded file
`format` = format/extension of the file that you want to download

#### **Example 1:**
Simple Example
``` html
Click to Trigger Download!
```
#### **Example 2:**
Pro Example , incase you need to pass url that contains `&` , we will just encode the url and then pass it. Let's assume you have to download from this url https://avatars.githubusercontent.com/u/81325730?v=4 then we will first use `encodeURIComponent` to remove the `&` from URL and then pass it in anchor tag.
Simple HTML
``` html
Click to Trigger Download!

const url = encodeURIComponent(https://avatars.githubusercontent.com/u/81325730?v=4)

```
React/NextJS
``` javascript
Click to Trigger Download!
```
Similary, you can also pass variable as filename and format !

## Second:
You can copy `download.js` file from public/api folder of this repository and use it as your own API and you can also customise it as per your choice.

**ENJOY!**