Can we reuse assets from one Replit project into another?

Hi there!
I want to know if there is a way to use the assets uploaded in one Replit file/project in another file. Since each Replit file has a storage limitation, say 1GB, I want to reuse assets that I am uploading across projects. When I copy the asset link from any project’s file tree and refer to it in another file, it doesn’t work. And when I try to open that link in the browser, it doesn’t work either (screenshot attached).

I cannot find a way to make the project assets public so that they can be reused (what ChatGPT suggested).
I am new to Replit, and I am on the Education plan.

Please guide.
Thanks!

1 Like

Yes, you can reuse assets. Open a file in your browser (using the repl.co domain), then use it by its URL in your other repl.


Side note: ChatGPT doesn't know what it's talking about. It just outputs the words that are most likely to (a) sound true and (b) make the user happy. It has no idea if its information is accurate, and it doesn't care.
I assumed that you are using static ("HTML/CSS/JS") repls.
3 Likes

Welcome! I see this is your first post. As a note, if an answer matches what you’re looking for, then mark that as “Solution.”

I see that you are grabbing the image straight from replit.com
If you want to upload assets on a repl, I suggest doing it in HTML/CSS/JS language.
Doing so will give you a web page, and on that webpage, and then you get the file by adding the path to the end of the URL.

For example (I use this on my repls) assetstoki.doxr.repl.co/mosh.gif
Instead of replit.com/@doxr/assetstoki#mosh.gif (that is the incorrect link and it won’t give you the direct link to the file.)

Then, on whatever repl you wish, you can get that file like this:

<img src="https://assetstoki.doxr.repl.co/mosh.gif" alt="a reused asset">
2 Likes

Hey, this works!
Thanks for the prompt response!

Is there a way to convert replit. com URL to reply. co asset URL?

For instance, when I copy the URL from the project’s file tree, I get:
https://replit.com/@akshansh-dt/360-Photo-Slideshow#image-1.jpg

And, when I change the format based on your recommendation, I need this:

What can I do to get this URL automatically?

After changing the link, I need this:
https:// 360-photo-slideshow. akshansh-dt. repl. co/ image-1.jpg

How can I get this by default?

(somehow, two links are not getting pasted in my response)

Hey,
How can I open the file in repl.co domain?
I am copying the link to the image using the project file tree.

Copying the file path from the original Repl using the Copy file path won’t work if you try to use the URL it provided.

You will need to convert it like how you did here.

I will try to create an API for you that allows you to convert the file paths to the raw file URL.

1 Like

That would really help if there is a direct way to create Repl.co files using API. Thanks!

I decided to create a Javascript library because I don’t want to pay cycles to keep the API alive.

You can download the file linked here or go to the website to manually get the URL.

1 Like

This is perfect! Thanks a lot!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.