New npm package : glitch-assets

I’ve uploaded a small package to npm to help with loading your .glitch-assets file into a data structure in your program.

There are mainly three things about the .glitch-assets file that this package abstracts for you. It’ll return you JS object with each asset keyed using it’s uuid. The three main things the package helps with is:

  • each asset is a JSON structure on a line of it’s own (the file isn’t just one big JSON file)
  • each deleted asset is an extra line in the file just specifying the uuid and that it has been deleted - presumably because each action in the Glitch editor just appends an action to this file rather than modifies it
  • there is always a newline at the end of the file, so the final line (if splitting on newlines) is blank, so this is also catered for

You can use either callbacks or promises with the function call API.

Please let me know if you like it or if you have any problems or feature requests. :slight_smile: Thanks for any feedback.

4 Likes

I also just found this https://glitch.com/edit/#!/assets-lib by @etamponi and @Gareth but I don’t think it caters for deleted assets. I see that the assets are only marked as deleted in the .glitch-assets file though they still live in the S3 bucket, but I guess you don’t want to serve one up if you’ve deleted it from your project. :blush:

2 Likes