https://github.com/blixt/js-starbound-assets
This library enables loading Starbound assets via a Web Worker.
https://github.com/blixt/js-starbound-assets
Last synced: 5 months ago
JSON representation
This library enables loading Starbound assets via a Web Worker.
- Host: GitHub
- URL: https://github.com/blixt/js-starbound-assets
- Owner: blixt
- License: mit
- Created: 2014-02-11T04:58:23.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2015-01-29T21:52:18.000Z (over 11 years ago)
- Last Synced: 2025-02-24T06:55:38.659Z (over 1 year ago)
- Language: JavaScript
- Size: 336 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Starbound Assets
================
Manage Starbound assets.
Example
-------
Here's how you might use this package to extract a sound from the
assets file:
```js
var starbound = require('starbound-assets');
// Create an assets manager which will deal with package files etc. It
// will create a worker, which means you need to point it to where the
// worker.js file is stored.
var assets = new starbound.AssetsManager({workerPath: 'worker.js'});
// Assume file is a File object pointing to `assets/packed.pak`.
var file = ...;
// Load up the assets package and play a sound from it.
assets.addFile(file, function () {
// Welcome to the jungle!
var sound = '/sfx/environmental/jungle_day.ogg';
assets.getBlobURL(sound, function (err, url) {
var audio = new Audio();
audio.autoplay = true;
audio.src = url;
document.body.appendChild(audio);
});
});
```