How to get file tree for fs


#1

One of my projects is basically using nodejs fs to stream a audio file. But due to glitch’s weird asset system I don’t know how I should reference the file. Using the url seems not to work.


#2

fs can only interact with local files. Use ‘wget url’ from the console to import the asset file locally - click copy on the file in the assets list to copy the url you need.


#3

i didn’t understand any thing can u explain


#4

Hi @ELMUSAUIDK, welcome to the Glitch forum!

You’ll need to find the asset you want to use and collect its url. This image might help:

Then use that url in your project’s console:

with the wget command (like wget copied-file-url) to save the file to your project’s local file system. From there you can use fs to work with the file.

Keep in mind that the file in your project’s assets drawer doesn’t take up any of your project’s disk space, but once you save it locally it will.