waudbase64
v1.0.7
Published
Base64 generator for waud.js
Downloads
8
Maintainers
Readme
waudbase64
Base64 generator for waud.js
Base64 decoding is widely supported across all browsers.
###Installation
npm install -g waudbase64
###Usage
waudbase64 -i sounds -o sounds.json
###Help
waudbase64 --help
info: Usage: waudbase64 -i sounds -o sounds.json
info: Options:
--input, -i input folder (default: ./)
--output, -o output JSON file (default: sounds.json)
--noBasePath, --nb doesn't prepend base path to each asset id
--help, -h help
###Example with waud.js
var base64pack = new WaudBase64Pack("assets/sounds.json", _onLoad);
function _onLoad(snds:Map<String, IWaudSound>) {
snds.get("assets/beep.mp3").play();
}
###Sample
http://waud.github.io/sample/base64.html
###More Info
Note that the file size of base64 encoded JSON file will be more than the actual sound file(s).
But if your web server have gzip compression enabled for JSON files then the network transfer size will be smaller than loading individual sound files.
Enabling gzip compression is a standard practice and most likely your web server has it enabled already and to verify that you can open the network tab in chrome developer tools and click on any JSON file that's loaded. If you notice Content-Encoding:gzip
in Response Headers section then it's already enabled.
Some numbers for example:
Size of 6 individual mp3 sound files before base64 encoding: 589 KB
Size of base64 encoded JSON with all the 6 sounds: 785 KB
Network transfer size with gzip enabled: 552 KB
Licensing Information
This content is released under the MIT License.
Contributor Code of Conduct
Code of Conduct is adapted from Contributor Covenant, version 1.4