GithubHelp home page GithubHelp logo

vishwagauravin / trigger-download-file-pro Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 0.0 114 KB

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

Home Page: https://triggerdownload.herokuapp.com

License: MIT License

JavaScript 100.00%
downloader download-file download download-videos download-songs download-photos file-downloader trigger-events javascript nextjs

trigger-download-file-pro's Introduction

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 <a> 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

<a href="https://triggerdownload.herokuapp.com/api/download?url=https://ytdlpro.herokuapp.com/def_thumb.jpg&filename=logo&format=jpg">Click to Trigger Download!</a>

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

<a href="https://triggerdownload.herokuapp.com/api/download?url="+url+"&filename=test&format=jpg">Click to Trigger Download!</a>
<script>
  const url = encodeURIComponent(https://avatars.githubusercontent.com/u/81325730?v=4)
</script>

React/NextJS

<a href="https://triggerdownload.herokuapp.com/api/download?url="+encodeURIComponent(https://avatars.githubusercontent.com/u/81325730?v=4)+"&filename=test&format=jpg">Click to Trigger Download!</a>

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!

trigger-download-file-pro's People

Contributors

vishwagauravin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.