Yipes... best way to do the following?

In this case I’m trying to upload a set of files in various folders that represent the output of a web socket app written using TypeScript. Rather than try to build it all on Glitch I figured that the output files could be copied into place.

I tried to upload a .zip file with the files and folders. It appears to treat it as an asset which (I don’t think) is the folder I want that file in. I was going to upload each file individually but the README.md file similarly ended up in the assets folder.

Is there a way to “easily” copy a folder structure and files from somewhere to my Glitch project? Thanks.

Well I published the output to a separate project on GitHub which made importing it quite easy. I guess I’m wondering if that is the best way and/or the only way?

Yes, if you drag files and folders into the Glitch editor it will generally upload them as assets, which are not files within your project at all but in fact hosted in a bucket of the Glitch CDN that loosely corresponds to your project.

However, from there, there is a trick to “pull” them into the Glitch project using the terminal.

  • Upload it to your assets
  • Grab the asset link like https://cdn.glitch.com/cb562394-de5e-45a2-a7c3-8f9f92dfcd96%2F...?v=1598516091882 and strip off the ?v= bit
  • Open the Glitch terminal
  • Run:
wget -O myZip.zip `https://cdn.glitch.com/cb562394-de5e-45a2-a7c3-8f9f92dfcd96%2FmyZip.zip`

This outputs (-O) your asset to the given file name. You can put a directory here like stuff/myZip.zip if you want.

You can unzip it with the unzip command (I haven’t tested this but have seen others do it)

Then, in the terminal, run

refresh

To see your file structures in the Glitch editor.

Just another tool for your belt. Have fun :slight_smile:

That is definitely a possibility thanks. I did check if a zip utility was available and it responded with the help message so I assume that will work. I am a little hesitant to upload a zip file into the assets because it (as I understand things) not private to me. And there is if I recall no way to delete it.

I’m pretty happy with the GitHub method. I can set things up however I want there and simply pull in an update. It does involve another GitHub repo however unless I can figure out how to define a “pull these folder/files only” strategy. I assume there is such a mechanism if I read the docs.

The good news is that I was able to get an AltSpaceVR “MRE” running and could access it from my virtual world in ASVR. A little more polish and I believe it will be useable.

You can push from your computer to Glitch directly. Use the Import/Export Git URL. Then from the Glitch terminal, do git checkout on the branch that you pushed. Although pushing only a subset of files is a separate problem.

You can overwrite an asset with an empty file. Although there is a waiting period for the cached copy of the original file to disappear.

1 Like

Good info. I am considering using the Rollup bundler but generally I find bundlers to be a royal pain. Rollup is the only one that I have any chance of actually understanding.

Once the project is finished it isn’t really going to be being modified very often

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