Uploading/downloading font files (like .ttf or .woff) without using the assets folder

So, I’m trying to add special fonts (i.e. FontAwesome) to my website project, but no matter what it goes to the assets folder. I don’t want it like this since I can’t load the font unless it is in the project files, I believe.

Try a file-sharing service.
Such as file.io, gofile.io, transfer.sh, 0x0.st, etc

Hi there @sakuu! So when I need an asset in my root app folder, I copy the Glitch CDN url of the file in Assets, open the terminal and go to the directory I want the file and then I run wget example-cdn-url.ttf which will download the asset into that directory. It will have an ugly file name, but you can rename it by then running mv long-ugly-filename.ttf nice-file-name.ttf. Hope that helps!

7 Likes

You can also use wget’s O switch for better files names:

wget cdn.glitch.com/file-abc.woff -O font.woff

You may also want to put the url in quotes.

4 Likes

Here’s the curl version :stuck_out_tongue_winking_eye:

curl cdn.glitch.com/file-abc.woff --output font.woff
3 Likes

Oh no… curl and wget battle has begins :joy::joy::joy: Just kidding!

Again, Let me give you a trick. Request the attachment URL and do something like this:

const fetch = require("node-fetch");

fetch("https://cdn.glitch.com/abdkdhsjdhejehdha").then(res => {
   var stream = res.body;
   // The fwesh stream is coming.....
   // Do something fwesh with this incomming fwesh stream....
}).catch(console.error);
// Let's handle the promise rejection.

By the way, You can just import the Glitch CDN link at your CSS. Something like this:

body {
    .... : url(https://cdn.glitch.com/abssbdbdiahdidhejs);
}