Ask coding questions

← Back to all posts
How to give download url to a file
ConvertAPI (0)

Our script generated the file and it is saved in Files panel. We want to output message in the console and give download option to user to check the generated file. How to output downloadable file URL in the console.

Commentshotnewtop
TheForArkLD (618)

uhhhh you want give file to user?

ConvertAPI (0)

@TheForArkLD Yes, we want to give url to generated PDF file.

TheForArkLD (618)

@ConvertAPI wait i make api for upload file

ArnavBansal (15)

One way to let users download a file is to set up a simple web server. In NodeJS, you can use a library such as express (expressjs.com) to do so

ConvertAPI (0)

@ArnavBansal Is here no build in repl.it option to give URL to Files in repl? Your suggestion is overcomplicated.

ArnavBansal (15)

@ConvertAPI well, you could just link to the repl itself?

ConvertAPI (0)

@ArnavBansal How to output that in console? I want to put download URL into console.log("The images has been merged to merge.pdf file.") I have tried to do that like this ./merge.pdf but the file in console is not clickable. Just run demo and you will find that there is no way to provide download url to just created file.

ArnavBansal (15)

@ConvertAPI you can print a full URL to the repl. console.log('https://repl.it/@ConvertAPI/Chaining-JPG-to-PDF-then-MERGE') should be clickable.

We're also working on a way to deeplink to files in the repl (but it won't open it as a PDF, just a PDF inside the repl)

ConvertAPI (0)

@ArnavBansal I want to give download url to file not repl.

ArnavBansal (15)

@ConvertAPI https://repl.it/@ArnavBansal/Chaining-JPG-to-PDF-then-MERGE A download url requires there to be a server at the other end. I don't think there's a simple access URL to grab a single file. A server in nodejs is pretty simple to set up ^

ConvertAPI (0)

@ArnavBansal I can easily click download on the left in Files repository and can't understand why I can't add a reference to that file into the console and you suggesting to set up a file server. No makes sense.

NoelB33 (300)

You just can’t... of my knowledge. There’s really no way to explain it but you just can’t. @ConvertAPI