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.
- Host: GitHub
- URL: https://github.com/vishwagauravin/trigger-download-file-pro
- Owner: VishwaGauravIn
- License: mit
- Created: 2021-11-18T19:31:08.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-20T11:23:23.000Z (almost 4 years ago)
- Last Synced: 2025-04-08T10:41:41.780Z (6 months ago)
- Topics: download, download-file, download-photos, download-songs, download-videos, downloader, file-downloader, javascript, nextjs, react, reactjs, trigger-events
- Language: JavaScript
- Homepage: https://triggerdownload.herokuapp.com
- Size: 111 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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!**