A resource manager for delivering and reading content in browser-based games, work in progress

npm install swallow
3 downloads in the last month


Swallow is an asset packager for facilliating the loading process in browser based games, the idea being:

  • You have a large number of assets (textures, sounds, models, shaders) which are needed for the game to run
  • You want to know when they're all loaded so the game can start
  • You don't want to load most things on demand, but working out what you need is a bit of a bother
  • You want to package all of those assets into single deployable files as JSON and load them out the other side without changing too much code
  • You want to be able to create a package which can be played offline


Given a directory of assets, and an appropriate structure within:

  - assets
    - models
      - craft.json
      - tree.json
    - textures
      - craft.jpg
      - grass.jpg
      - snow.jpg
      - sky.jpg
      - smoke.jpg
    - sound
      - explosion.wav
      - engine.wav
    - shaders
      - super.fragment
      - super.shader
      - particles.fragment
      - particles.shader
    - etc

And a command as follows

swallow -i ./assets

A file (assets.json) will be generated containing all the data in the specified directory.


  • Dependencies between assets
  • per-level/world-area/ asset file generation (taking into account the dependencies)
  • pluggable handlers on the server side for generating output / specifying additional dependencies
  • client code for loading assets (promises and asynchronous load notifications)


Probably the above, try looking at the other libraries I run for other functionalities.

npm loves you