Hello, how to create a folder?

Hello, how to create a folder? if it’s not possible, how to use the files in the node code ./assets/ the file says that 400 Bad Request: host is invalid

Welcome to the Glitch Forums. To create a folder you have to make a file. Kinda like this, go to new file and type (folder_name)/(file_name)

1 Like

How can I download archives and use them?

Do you mean zip archives?

yes that’s right, there that would put a zip archive in the folder, or that you could use them from the assets folder

I also noticed that assets are not a folder and from it I can’t call a file in a script. What to do?

Hey @tanc41,

The assets folder is just a virtual folder in the project and doesn’t exist locally in the project. The only way to solve this problem is to create a local folder and uploading assets to that. To do this:

  1. Go to the assets folder in your project and select the image you want to upload locally to your Glitch project. Click on the ‘copy url’ button. This will copy an image url like https://cdn.glitch.com/68ece3d5-980b-4d94-b09a-6ea0770ea2cf%2Fdonut_white.png?v=1572257738465 to your clipboard.

  2. Create a new assets folder by typing mkdir assets and hit enter.

  3. type cd assets and hit enter to move into the assets folder

  4. type wget and then paste the image url you copied previously into the console, so you see something like wget https://cdn.glitch.com/68ece3d5-980b-4d94-b09a-6ea0770ea2cf%2Fdonut_white.png?v=1572257738465 and hit enter. That’ll import that image to your assets folder. Note that it’ll be imported with the name (the random bunch of letters and number in the image URL after the cdn.glitch.com/ part) 68ece3d5-980b-4d94-b09a-6ea0770ea2cf%2Fdonut_white.png?v=1572257738465 . To make it easier to deal with you’ll want to rename it. To do so, type mv /app/assets/68ece3d5-980b-4d94-b09a-6ea0770ea2cf%2Fdonut_white.png?v=1572257738465 /app/assets/donut_white.png and hit enter.

  5. Type refresh in the console to update your project directory and the new assets folder shows up in the project.

  6. Repeat steps 1 and 5 for each image you want to upload. Be sure to change the name of the file to the relevant one in step 4.

To call the file in your script, you’ll need to use the path: __dirname + '/assets/donut_white.png'

Note that the donut_white.png is just an example.

3 Likes

thank you very much. I’ll try it now