{"_id":"libflacjs","_rev":"9-9ad63cc60725bd3ce9dec74254f0b99c","name":"libflacjs","dist-tags":{"latest":"5.6.0"},"versions":{"5.0.0":{"name":"libflacjs","version":"5.0.0","keywords":["flac","audio","codec","encode","decode","emscripten","stream"],"license":"MIT","_id":"libflacjs@5.0.0","maintainers":[{"name":"russa","email":"aaron.russ@dfki.de"}],"homepage":"https://github.com/mmig/libflac.js","bugs":{"url":"https://github.com/mmig/libflac.js/issues"},"bin":{"libflac.js":"dist/libflac.js","libflac.dev.js":"dist/libflac.dev.js","libflac.min.js":"dist/libflac.min.js","libflac.wasm.js":"dist/libflac.wasm.js","libflac.wasm.wasm":"dist/libflac.wasm.wasm","libflac.js.symbols":"dist/libflac.js.symbols","libflac.min.js.mem":"dist/libflac.min.js.mem","libflac.dev.wasm.js":"dist/libflac.dev.wasm.js","libflac.min.wasm.js":"dist/libflac.min.wasm.js","libflac.dev.wasm.wasm":"dist/libflac.dev.wasm.wasm","libflac.min.wasm.wasm":"dist/libflac.min.wasm.wasm","libflac.dev.js.symbols":"dist/libflac.dev.js.symbols","libflac.min.js.symbols":"dist/libflac.min.js.symbols","libflac.wasm.js.symbols":"dist/libflac.wasm.js.symbols","libflac.dev.wasm.wasm.map":"dist/libflac.dev.wasm.wasm.map","libflac.min.wasm.js.symbols":"dist/libflac.min.wasm.js.symbols"},"dist":{"shasum":"a01d1473a670e72f46408495052a7db68e7ef58e","tarball":"https://registry.npmjs.org/libflacjs/-/libflacjs-5.0.0.tgz","fileCount":75,"integrity":"sha512-EWQNHZvIwHcZrLO8B/r0n1XpA1UZJKSd9SgPbJCYJlOMSniZpvvPJFObsUF4bYG95nSfMhov23wlcZo/xZ1KiA==","signatures":[{"sig":"MEUCIQD70l+F7aOxTR5WhCn30I3gJFQyvDr4fJAYjfSJp0rGQAIgETtWjg8pJmow2EB94nhBU2zDY2s/4MlkJDI4oehYVmg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6379421,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd4ESZCRA9TVsSAnZWagAAJFQQAKCg59boDDA8mcUcY5lr\nhYURKl3XXHYkwVW5WMSNR2/+ovKrJDEvd8sFvzyNei5FrgBdx98Uj4zkWdoi\nH5Rj9GHR3/c++hLRW/QG8+trxykun0/TCfyjDTejdQx5HDxk/J9bDhcRdhdb\nj7wE//MJnjj0FtkIVVaf9c549Q6zpyPvJ3t9fi1k3RPAxxvk9aDgE9iDxgmb\nnb2o1GXfWUtG73zaA6WCjBkL7xzw5vhY8Yq3ukrvDl/4zsmmYYWps51OBgm+\nKsA+8TUE91ULe1/VMY+hFXaR5we7wX8pvGclvAr8GbDleko2WwaAPmCwEUkY\nQ8gjgXwYJqNFbBB/FCwMQODJDikv7JCOj6Sfb0adDWd9aad3lbYFoxOQKr1w\nSlg6Xq0VnSOZtX82o20CDg4fUgUGrT9diwEVBN8vTDubtMDTJ+F0kyrFKzli\n3Y0t0tm4Bd24PL31RSpnuXky4GHq6FGRtbIqiehODVOlX57sIKGIids1yATS\njEDweON07XnHvxWGciLkFftGlSRK0Hsq3qVrLYxYRo8JW6wW8iINCMCb5qFE\n0dp4klpgxaSc9XTcNojIpP7NtaMygfIyteU6ap1XDq1NrcGPplJjZHIuWyQz\n8TgIqCOaGNzPznX3I5mgg3fXdv3N+Eg4/MOWn4Od/z5/TxWy0JTW2WDtwfrv\nYPxG\r\n=xc/+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"032d7cc8239b523447ecadce9988ed82cccf66a4","_npmUser":{"name":"russa","email":"aaron.russ@dfki.de"},"repository":{"url":"git+https://github.com/mmig/libflac.js.git","type":"git"},"_npmVersion":"6.7.0","description":"FLAC data stream encoder and decoder compiled in JavaScript using emscripten.","directories":{"bin":"dist","doc":"doc","example":"example"},"_nodeVersion":"11.15.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/libflacjs_5.0.0_1574978713102_0.7733797751989522","host":"s3://npm-registry-packages"}},"5.1.0":{"name":"libflacjs","version":"5.1.0","keywords":["flac","audio","codec","encode","decode","emscripten","stream"],"license":"MIT","_id":"libflacjs@5.1.0","maintainers":[{"name":"russa","email":"aaron.russ@dfki.de"}],"homepage":"https://github.com/mmig/libflac.js","bugs":{"url":"https://github.com/mmig/libflac.js/issues"},"bin":{"index.d.ts":"dist/index.d.ts","libflac.js":"dist/libflac.js","libflac.d.ts":"dist/libflac.d.ts","libflac.dev.js":"dist/libflac.dev.js","libflac.min.js":"dist/libflac.min.js","libflac.wasm.js":"dist/libflac.wasm.js","libflac.dev.d.ts":"dist/libflac.dev.d.ts","libflac.min.d.ts":"dist/libflac.min.d.ts","libflac.wasm.d.ts":"dist/libflac.wasm.d.ts","libflac.wasm.wasm":"dist/libflac.wasm.wasm","libflac.js.symbols":"dist/libflac.js.symbols","libflac.min.js.mem":"dist/libflac.min.js.mem","libflac.dev.wasm.js":"dist/libflac.dev.wasm.js","libflac.min.wasm.js":"dist/libflac.min.wasm.js","libflac.dev.wasm.d.ts":"dist/libflac.dev.wasm.d.ts","libflac.dev.wasm.wasm":"dist/libflac.dev.wasm.wasm","libflac.min.wasm.d.ts":"dist/libflac.min.wasm.d.ts","libflac.min.wasm.wasm":"dist/libflac.min.wasm.wasm","libflac.dev.js.symbols":"dist/libflac.dev.js.symbols","libflac.min.js.symbols":"dist/libflac.min.js.symbols","libflac.wasm.js.symbols":"dist/libflac.wasm.js.symbols","libflac.dev.wasm.wasm.map":"dist/libflac.dev.wasm.wasm.map","libflac.min.wasm.js.symbols":"dist/libflac.min.wasm.js.symbols"},"dist":{"shasum":"97b8e307d8aedfa2f5823ed44fe60b6181336cd0","tarball":"https://registry.npmjs.org/libflacjs/-/libflacjs-5.1.0.tgz","fileCount":87,"integrity":"sha512-d3SLaCwN51BMhMQvZZiJCfSzzqoBfQlJfymO+kF0Hq1fnrm6Z5VTql+mTFs0Gbj84M1bnIic+Vf5I1qmVs0P3g==","signatures":[{"sig":"MEUCIQChREHD524ytC9pm6J7sgVSrcUjyO2O94K5ltS9teaN8QIgG4+EeTNQrgKr2DVGhthy7L2Up7dLL4X6qVVhIiJyufI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6605154,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe0BHKCRA9TVsSAnZWagAAFUAP/2IszMq7xgiRHmVA9kVS\nDmdPbT9Ty0piIVFqy+i2DrcnydIt7HrmeW3cZtzshltcKWtIKtLeDK9+d4wp\n2FilY1nJpgZqWHKjgfljTOy9wnZkJGMEawRtH0BWbcbTWpN+o6BB/9Xxo4PL\ntzGdbFTIlB3vVo+wh2kbD4zIzON3vWS6JvFvpl4meHkFBhsS4nkxnnlNI9nJ\naH11ZVeCiFSHdVV4JMvx13d9xEBSLB+1lTHCAN9tEIWeGjrvlLFRr1FTIlqA\nKLD7Z+JGYpovYeonmx0d/Mv3g4LSHQCCoR0T/Xw373YINgNjVt20NLuMKz4Q\nCGNFqM54Pb4Dqm1/btLRvKcknAF/BspEcwjjwqjZHtb+h12E6ygLo3K1445G\nfFEI+CfoW2bvkMobgey90CxYm3bgg2Q/zucUig18kyZnIhVWU+NN1OEBX1KF\nQu/3T/SLD9TBF4OcPprqGDWEWbGyFspvBWgoIFuUrojivhL4eUQDGU6wQHrF\nITyWewMFi8UVXjEFXrFHKQ9H4qrR/qoZNdToz7vZl6wSluJe6272CUB2WxWQ\nZ1HKFDJNqfg1uiKtMQPQTEDQSzgMMa1IJBIoODPb8RC1ZFR8Rok3hKKbkJW1\naytvstZeLqhL/p3riPcd6SRhIKj7WlAyE0i6pL47BNeG5eFuGSSRMGFBzJog\nK1bM\r\n=8gmZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"9124a7934d44582950f7e7d3d9d8978ddd25ef00","_npmUser":{"name":"russa","email":"aaron.russ@dfki.de"},"repository":{"url":"git+https://github.com/mmig/libflac.js.git","type":"git"},"_npmVersion":"6.14.4","description":"FLAC data stream encoder and decoder compiled in JavaScript using emscripten.","directories":{"bin":"dist","doc":"doc","example":"example"},"_nodeVersion":"12.16.3","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/libflacjs_5.1.0_1590694345211_0.6468423181647731","host":"s3://npm-registry-packages"}},"5.1.1":{"name":"libflacjs","version":"5.1.1","keywords":["flac","audio","codec","encode","decode","emscripten","stream"],"license":"MIT","_id":"libflacjs@5.1.1","maintainers":[{"name":"russa","email":"aaron.russ@dfki.de"}],"homepage":"https://github.com/mmig/libflac.js","bugs":{"url":"https://github.com/mmig/libflac.js/issues"},"bin":{"index.d.ts":"dist/index.d.ts","libflac.js":"dist/libflac.js","libflac.d.ts":"dist/libflac.d.ts","libflac.dev.js":"dist/libflac.dev.js","libflac.min.js":"dist/libflac.min.js","libflac.wasm.js":"dist/libflac.wasm.js","libflac.dev.d.ts":"dist/libflac.dev.d.ts","libflac.min.d.ts":"dist/libflac.min.d.ts","libflac.wasm.d.ts":"dist/libflac.wasm.d.ts","libflac.wasm.wasm":"dist/libflac.wasm.wasm","libflac.js.symbols":"dist/libflac.js.symbols","libflac.min.js.mem":"dist/libflac.min.js.mem","libflac.dev.wasm.js":"dist/libflac.dev.wasm.js","libflac.min.wasm.js":"dist/libflac.min.wasm.js","libflac.dev.wasm.d.ts":"dist/libflac.dev.wasm.d.ts","libflac.dev.wasm.wasm":"dist/libflac.dev.wasm.wasm","libflac.min.wasm.d.ts":"dist/libflac.min.wasm.d.ts","libflac.min.wasm.wasm":"dist/libflac.min.wasm.wasm","libflac.dev.js.symbols":"dist/libflac.dev.js.symbols","libflac.min.js.symbols":"dist/libflac.min.js.symbols","libflac.wasm.js.symbols":"dist/libflac.wasm.js.symbols","libflac.dev.wasm.wasm.map":"dist/libflac.dev.wasm.wasm.map","libflac.min.wasm.js.symbols":"dist/libflac.min.wasm.js.symbols"},"dist":{"shasum":"55fae1f3dff6ff293e391414e9ecac47bd3be16b","tarball":"https://registry.npmjs.org/libflacjs/-/libflacjs-5.1.1.tgz","fileCount":87,"integrity":"sha512-mqbludLh7PL3jQco5lelFAPhQt9obhap45KReW+wgu7zojmOSkS77lKRjHMEaZlDymZ5mB7NXu/2RBiG4N7ytw==","signatures":[{"sig":"MEUCIQCim43tlTwRzHzv8XXdrn+aBcWK28caE8uI7lQxgm+0aQIgIg+XXqQmcqOoFVOGKfkTzdx9qleEM8zCJBFao0gB0II=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6605671,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe0B6dCRA9TVsSAnZWagAAFioP/jwKU4/Zs28Goq0KA2FU\nRlN8wKzERdWIYRybjPRjfqMamVR07a/ZJBIaFDjnE2OpsP6h0MQe6cDHFZe4\nTADLOZdKqh2A4Yil2EzpJ8ErYezx403aSCClN4iW1nvyCUGm5PSbMPbTDYZp\noCW2xjHwBVzsFJAfzU4CAr19AVI1UIcmgcXE+hYRAdwuU9P0mDrqdSCC3+05\nIpiSbc5LLEhLiwRE5jovIiHq6KdEx2QlEo5o1mz2yza/EsUKI9uweeMtNfsP\nAxiolHxk4tyfhNFFNe3AA4YAqR0cXcFjl5Tm2M2FCXPDZaqyAihY17TovlbP\ne9MBgVq+dEfiV+YwowWcUyebiKVb0yCXcmbKm/t9aVApP1SIx4uhY+cNfMSo\nc1cZcapxYod2aWolPcOSrW0jpmzPL3FoCVoLMWwbDRCZVInhstLdHzg9FcFg\nyVs/evGXd8DZz21vshqb/n7WXKAbe3De/yWjFJEEraQ40zG7EhN3AeNMAeQB\nNIDIUnPYjV0cNw+bahK5PDLSAJpGsk6hCgxjc6GeqOoEIb3IWwN6KoDM1IIZ\nYuHaVoGJlVLjGFPbmd5Ch7L15d0RyEyQO4RJDWJ6MoU0gi3xxW0ad71fBrnw\nETBb+1pHnCiNyLNLlfGJUlvA9/UmcrKu9s4cW0vSC5bZyi8kSkPJ/kSQ3wcU\nG2l/\r\n=VKNy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"ea08aef68fba2c272de459737f5e96dd3f6deeaa","_npmUser":{"name":"russa","email":"aaron.russ@dfki.de"},"repository":{"url":"git+https://github.com/mmig/libflac.js.git","type":"git"},"_npmVersion":"6.14.4","description":"FLAC data stream encoder and decoder compiled in JavaScript using emscripten.","directories":{"bin":"dist","doc":"doc","example":"example"},"_nodeVersion":"12.16.3","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/libflacjs_5.1.1_1590697628846_0.380651014336282","host":"s3://npm-registry-packages"}},"5.2.0":{"name":"libflacjs","version":"5.2.0","keywords":["flac","audio","codec","encode","decode","emscripten","stream"],"license":"MIT","_id":"libflacjs@5.2.0","maintainers":[{"name":"russa","email":"aaron.russ@dfki.de"}],"homepage":"https://github.com/mmig/libflac.js","bugs":{"url":"https://github.com/mmig/libflac.js/issues"},"bin":{"index.d.ts":"dist/index.d.ts","libflac.js":"dist/libflac.js","libflac.d.ts":"dist/libflac.d.ts","libflac.dev.js":"dist/libflac.dev.js","libflac.min.js":"dist/libflac.min.js","libflac.wasm.js":"dist/libflac.wasm.js","libflac.dev.d.ts":"dist/libflac.dev.d.ts","libflac.min.d.ts":"dist/libflac.min.d.ts","libflac.wasm.d.ts":"dist/libflac.wasm.d.ts","libflac.wasm.wasm":"dist/libflac.wasm.wasm","libflac.js.symbols":"dist/libflac.js.symbols","libflac.min.js.mem":"dist/libflac.min.js.mem","libflac.dev.wasm.js":"dist/libflac.dev.wasm.js","libflac.min.wasm.js":"dist/libflac.min.wasm.js","libflac.dev.wasm.d.ts":"dist/libflac.dev.wasm.d.ts","libflac.dev.wasm.wasm":"dist/libflac.dev.wasm.wasm","libflac.min.wasm.d.ts":"dist/libflac.min.wasm.d.ts","libflac.min.wasm.wasm":"dist/libflac.min.wasm.wasm","libflac.dev.js.symbols":"dist/libflac.dev.js.symbols","libflac.min.js.symbols":"dist/libflac.min.js.symbols","libflac.wasm.js.symbols":"dist/libflac.wasm.js.symbols","libflac.dev.wasm.wasm.map":"dist/libflac.dev.wasm.wasm.map","libflac.min.wasm.js.symbols":"dist/libflac.min.wasm.js.symbols"},"dist":{"shasum":"29f74121d2a79b5273d2f0e82901465baddf9b7d","tarball":"https://registry.npmjs.org/libflacjs/-/libflacjs-5.2.0.tgz","fileCount":99,"integrity":"sha512-IK6lsJoOkIYZcTTJVViC7VPOsnZayJ7DfKB9BCUhYeqpfOJk5P8O96gcxYxFxUgNa1e2Sm4alI7W5fAov3qzmQ==","signatures":[{"sig":"MEUCID3Z0A9fz/5ai0a9kLBja/iu/orPE0YtNpZ3yVdAcWrzAiEAilIKzplwY3QidLAjyK5M/J1C9Dnyh2Yb6m57L+10pL0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6295077,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe6pnGCRA9TVsSAnZWagAARNQQAIOb/rjxGHjY3t3c1lIR\nwwr4m1Wgcqu0sMZt7klq9sdAadbnBuUNLbDbAN9liqbpzR2Qs8l+XyoXux6z\nYimNZTkhHavDoGTIODRKfiuJh2iMGHwJPq4PSIiS/oEAKzt0fLwNqDunMcmv\nzWbZIp20bfUqYTQeg/OnlMfzAS1urBV2bGTwfESAMos3pr2EBKfoSBpHZ8NX\nyr+z6O5acJAH66OcSQxZ/O9xDsmUZSS/3cuZyiMu2mvefUiil6mQdcfXR5r8\nrbFdWF5oXFnqUaWOqGdttBRaEvT47CW6EuiRnBFgT9Mg9TPcShfQrJGTOVGF\n0ioKBG/ttKgl4D8alKpUpNErbDV7rR9LRCc/TihWVrHgkQ/zv83MwkU/ETYu\nvk/Ocyox5ytfkgK20qaKREHI/nu77IFA+hjrPyJpaf7QTNok8wtqa3CpclHw\nO7dJ77gfaYYchPPS9BaVgMcJUX7aflmE6w0A7rNKDmcZq6YaSWRiyBaOmfRy\nzXn3e8vcAz0iS9K90ILKLWFjLRnwZ3CivZMPWOAxkmusmxxt2r5je4VpAPHS\n0eaeeRtUu0gC1LW0Tv7CchYyIOEusPPTnQxL2Y0rL81Gt1J11Zz5yaff7Ti+\njFz0A2q9J2CqnHQT1oklC7NaLQOneeHMWOw4NasgzdpEh7C86m8lIeHm9+vk\nII8T\r\n=BJL8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"bbf7980ac0f7c58c65de39c0a5a2ed94efacc2d5","_npmUser":{"name":"russa","email":"aaron.russ@dfki.de"},"repository":{"url":"git+https://github.com/mmig/libflac.js.git","type":"git"},"_npmVersion":"6.14.4","description":"FLAC data stream encoder and decoder compiled in JavaScript using emscripten.","directories":{"bin":"dist","doc":"doc","example":"example"},"_nodeVersion":"12.16.3","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/libflacjs_5.2.0_1592433094195_0.6888011217067083","host":"s3://npm-registry-packages"}},"5.3.0":{"name":"libflacjs","version":"5.3.0","keywords":["flac","audio","codec","encode","decode","emscripten","stream"],"license":"MIT","_id":"libflacjs@5.3.0","maintainers":[{"name":"russa","email":"aaron.russ@dfki.de"}],"homepage":"https://github.com/mmig/libflac.js","bugs":{"url":"https://github.com/mmig/libflac.js/issues"},"bin":{"index.d.ts":"dist/index.d.ts","libflac.js":"dist/libflac.js","libflac.d.ts":"dist/libflac.d.ts","libflac.dev.js":"dist/libflac.dev.js","libflac.min.js":"dist/libflac.min.js","libflac.wasm.js":"dist/libflac.wasm.js","libflac.dev.d.ts":"dist/libflac.dev.d.ts","libflac.min.d.ts":"dist/libflac.min.d.ts","libflac.wasm.d.ts":"dist/libflac.wasm.d.ts","libflac.wasm.wasm":"dist/libflac.wasm.wasm","libflac.js.symbols":"dist/libflac.js.symbols","libflac.min.js.mem":"dist/libflac.min.js.mem","libflac.dev.wasm.js":"dist/libflac.dev.wasm.js","libflac.min.wasm.js":"dist/libflac.min.wasm.js","libflac.dev.wasm.d.ts":"dist/libflac.dev.wasm.d.ts","libflac.dev.wasm.wasm":"dist/libflac.dev.wasm.wasm","libflac.min.wasm.d.ts":"dist/libflac.min.wasm.d.ts","libflac.min.wasm.wasm":"dist/libflac.min.wasm.wasm","libflac.dev.js.symbols":"dist/libflac.dev.js.symbols","libflac.min.js.symbols":"dist/libflac.min.js.symbols","libflac.wasm.js.symbols":"dist/libflac.wasm.js.symbols","libflac.dev.wasm.wasm.map":"dist/libflac.dev.wasm.wasm.map","libflac.min.wasm.js.symbols":"dist/libflac.min.wasm.js.symbols"},"dist":{"shasum":"f74db0831486ece24724b73291937700b2127878","tarball":"https://registry.npmjs.org/libflacjs/-/libflacjs-5.3.0.tgz","fileCount":101,"integrity":"sha512-xc3QOF84/MmJgxYaX9pNeF4J7GpQ7STSWUli5zuXva5Fhf5J+tg4LNlT3SabpC6RuIa6FpHMLnDTlsJteCp/6g==","signatures":[{"sig":"MEUCIHquAw8uKicjOWyHFPR4+hf/l9OpsDGBolxqBoDJVi2MAiEA7c4J7etyyz//uYABlHFbAcmmOHPdaj3RdKJyovBXRZs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6526957,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe7aS9CRA9TVsSAnZWagAA3ZAQAINHX7liA2XMFFWaL4qU\nM4nwHA8kAJJZbcoXqWv9hSTtNQEF9osdOCBAf1uDubxcsX7OajfHeoQVLoYp\n+FssgHE+lOAUTz8K9qghlgW3sWOrmvN7myTwQkDA5OpmVkbLX8P9FA6hjVqn\nEy7chWtCy1+V5Ay73VMFgshPL8UfioHGgUZMIrK5ojhsYeRQpEOjnnWK+9EP\nLs4afATmyBwSvHJJw6qZXjp08eR+vQXDvSNYISJ3RTCTFv19r1vBKQ4dtGpP\nNGIgjGhCgOmWuxKaoUPwCLL6ttW7WXLTaPA60vEGu+2Ogm4bLSvs2VYkvf3s\nhxcONszTJyGaLOP3ziJdXd68w1b+lhTP1Uha5EilTfWf/S5emfWHwLNxlpXj\nwcVLDvOqm9W6uTjywSlqgGdIhZckM+0FIX4+ACRw5RZq0UwNZG7sACE76UCp\nqFK4sq3KVWz+mUKN55/C6bh0cYNLR/YnHYzG1PBAkxHmpJUH2xOC09VleoE9\nWbp44E9HoDdxUH0s370vINeKgOEbNz2uvzA65dzh0LFBOwODnx5LDyxmqall\nPEmL2ZGhK26csFEefoiX7KsUz4xe8j6/H8OFQ/w2XvcwD9C7Y2rSkb8QCgMB\nmqu0p+P79K2D6eQouZFJyEoUovxFHuZEq9XQL6XX+xvQ4BQkFu+LuQ8Jd4gj\nB7Fb\r\n=G0vj\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"2612938ac8973053d96a081f971695453496ea32","_npmUser":{"name":"russa","email":"aaron.russ@dfki.de"},"repository":{"url":"git+https://github.com/mmig/libflac.js.git","type":"git"},"_npmVersion":"6.14.4","description":"FLAC data stream encoder and decoder compiled in JavaScript using emscripten.","directories":{"bin":"dist","doc":"doc","example":"example"},"_nodeVersion":"12.16.3","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/libflacjs_5.3.0_1592632508487_0.6191776769667989","host":"s3://npm-registry-packages"}},"5.4.0":{"name":"libflacjs","version":"5.4.0","keywords":["flac","audio","codec","encode","decode","emscripten","stream","metadata"],"license":"MIT","_id":"libflacjs@5.4.0","maintainers":[{"name":"russa","email":"aaron.russ@dfki.de"}],"homepage":"https://github.com/mmig/libflac.js","bugs":{"url":"https://github.com/mmig/libflac.js/issues"},"bin":{"index.d.ts":"dist/index.d.ts","libflac.js":"dist/libflac.js","libflac.d.ts":"dist/libflac.d.ts","libflac.dev.js":"dist/libflac.dev.js","libflac.min.js":"dist/libflac.min.js","libflac.wasm.js":"dist/libflac.wasm.js","libflac.dev.d.ts":"dist/libflac.dev.d.ts","libflac.min.d.ts":"dist/libflac.min.d.ts","libflac.wasm.d.ts":"dist/libflac.wasm.d.ts","libflac.wasm.wasm":"dist/libflac.wasm.wasm","libflac.js.symbols":"dist/libflac.js.symbols","libflac.min.js.mem":"dist/libflac.min.js.mem","libflac.dev.wasm.js":"dist/libflac.dev.wasm.js","libflac.min.wasm.js":"dist/libflac.min.wasm.js","libflac.dev.wasm.d.ts":"dist/libflac.dev.wasm.d.ts","libflac.dev.wasm.wasm":"dist/libflac.dev.wasm.wasm","libflac.min.wasm.d.ts":"dist/libflac.min.wasm.d.ts","libflac.min.wasm.wasm":"dist/libflac.min.wasm.wasm","libflac.dev.js.symbols":"dist/libflac.dev.js.symbols","libflac.min.js.symbols":"dist/libflac.min.js.symbols","libflac.wasm.js.symbols":"dist/libflac.wasm.js.symbols","libflac.dev.wasm.wasm.map":"dist/libflac.dev.wasm.wasm.map","libflac.dev.wasm.js.symbols":"dist/libflac.dev.wasm.js.symbols","libflac.min.wasm.js.symbols":"dist/libflac.min.wasm.js.symbols"},"dist":{"shasum":"0f885a82536d5835ac65b3810a92f2c1234f33e2","tarball":"https://registry.npmjs.org/libflacjs/-/libflacjs-5.4.0.tgz","fileCount":160,"integrity":"sha512-O/MRbhnRiEXAT4K5q3YWUnyEhg7EJ7+2LNyRmOdxApWLdowi9QVGQqKGYHQg6Wx5l4qp6V7f62Utb1z/ESWqPw==","signatures":[{"sig":"MEUCIQCO5rC5bfYPjBc+1GE6sLzWI2b89bK+b0tE3siFxwkjzgIgHECYP/S8BCfePnXwTteh6awdvgJ8svs4Bna9BE3B6O4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":8032779,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCUKaCRA9TVsSAnZWagAAFMsP/R0dCz/CpsyJrW9vCoWZ\ngm6mVdrDPvw+whRSnB/MAR6vPLF1cf4r9DLFQdNTv772DYdNfeUTDftetl7p\nKVDJcomJN2DWVdEN+rvSCAuRxcxskZcC4aEzPCk93CWjfIjfDb3Mu0cDXhf/\nqE0lt3wXaGsLUM9FwqTY4Bq3FFU7YO1qgyBp5Yik3+86uO/CF1Vn0jdMkhqn\nG1Sd16iBfpkMTLstHZbOQo3w9vkJWvwG9cgoflEx2CeE59kS0+S6YCISimKM\nrIucCZ5PUwfWIneImwtYWruSjrFMVl6hbmSNXKL9GF7CNYWYZjkgIhRoxdDX\nud66ZZgJsFe3ibrx188PuLtSqL/NAvnL3Fxgjsjcef27ogYgljPHmoi3G+/N\n8Z0zoz7oW8LKiyj0bbAFPtU9WFq6pNAXkGwzSNHsmAIrazAHVb3IOhKkcscV\nHF2eZoNScle8vIvsQHWjUbkByxeHVhsngDCDpTPLB5GzZ6buh0Sk/34KivoK\njVintw6Y9pMArvt+R6TFKJ7pA8rSbMdXHVuBZ47Zho+z5UyPVj4aLYd8KJK+\nn7s0Z6M1L2UA9nvJRQirVpfRxxAfG+4rxWULo+hqORquIqjjHlYvTcqEQE9d\nLy6qzL+xebG46PJUHjQVJ3VIrYM5ARllFo0Eay6giVgnl/y5C94HD1LzgxrF\nUenl\r\n=ublv\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"2fb3d54ffd70f1da7b7a610e04bc3dc533de841d","_npmUser":{"name":"russa","email":"aaron.russ@dfki.de"},"repository":{"url":"git+https://github.com/mmig/libflac.js.git","type":"git"},"_npmVersion":"6.14.4","description":"FLAC data stream encoder and decoder compiled in JavaScript using emscripten.","directories":{"bin":"dist","doc":"doc","example":"example"},"_nodeVersion":"12.16.3","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/libflacjs_5.4.0_1594442394045_0.44704765873634567","host":"s3://npm-registry-packages"}},"5.5.2":{"name":"libflacjs","version":"5.5.2","keywords":["flac","audio","codec","encode","decode","emscripten","stream","metadata"],"license":"MIT","_id":"libflacjs@5.5.2","maintainers":[{"name":"russa","email":"aaron.russ@dfki.de"}],"homepage":"https://github.com/mmig/libflac.js","bugs":{"url":"https://github.com/mmig/libflac.js/issues"},"bin":{"index.d.ts":"dist/index.d.ts","libflac.js":"dist/libflac.js","libflac.d.ts":"dist/libflac.d.ts","libflac.dev.js":"dist/libflac.dev.js","libflac.min.js":"dist/libflac.min.js","libflac.wasm.js":"dist/libflac.wasm.js","libflac.dev.d.ts":"dist/libflac.dev.d.ts","libflac.min.d.ts":"dist/libflac.min.d.ts","libflac.wasm.d.ts":"dist/libflac.wasm.d.ts","libflac.wasm.wasm":"dist/libflac.wasm.wasm","libflac.js.symbols":"dist/libflac.js.symbols","libflac.min.js.mem":"dist/libflac.min.js.mem","libflac.dev.wasm.js":"dist/libflac.dev.wasm.js","libflac.min.wasm.js":"dist/libflac.min.wasm.js","libflac.dev.wasm.d.ts":"dist/libflac.dev.wasm.d.ts","libflac.dev.wasm.wasm":"dist/libflac.dev.wasm.wasm","libflac.min.wasm.d.ts":"dist/libflac.min.wasm.d.ts","libflac.min.wasm.wasm":"dist/libflac.min.wasm.wasm","libflac.dev.js.symbols":"dist/libflac.dev.js.symbols","libflac.min.js.symbols":"dist/libflac.min.js.symbols","libflac.wasm.js.symbols":"dist/libflac.wasm.js.symbols","libflac.dev.wasm.wasm.map":"dist/libflac.dev.wasm.wasm.map","libflac.dev.wasm.js.symbols":"dist/libflac.dev.wasm.js.symbols","libflac.min.wasm.js.symbols":"dist/libflac.min.wasm.js.symbols"},"dist":{"shasum":"b9facd7b493e1995edf9a5883d740e773bed248e","tarball":"https://registry.npmjs.org/libflacjs/-/libflacjs-5.5.2.tgz","fileCount":192,"integrity":"sha512-A199Z1eqgU+mFR3yBP9KJaCdh0JJFjbprKDs1PmeE3/bTyT47ijDhX5jBcRI9Z4AaCpVGhm2iAw/ah7pYSnONg==","signatures":[{"sig":"MEUCIQCtDQvBYqYZB39Q5/jJ9bLlnhe+i7w7p2UY8HA1Q4UMDgIgKANqgAuGSLpizz4byG1VeGkofXFHVBJnJoJ33/kAT4I=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8228269},"main":"index.js","types":"./index.d.ts","gitHead":"69a3d0aa90b8f6e63db9715a389c314e994fb932","_npmUser":{"name":"russa","email":"aaron.russ@dfki.de"},"repository":{"url":"git+https://github.com/mmig/libflac.js.git","type":"git"},"_npmVersion":"8.19.4","description":"FLAC data stream encoder and decoder compiled in JavaScript using emscripten.","directories":{"bin":"dist","doc":"doc","test":"tools/test","example":"example"},"_nodeVersion":"16.20.2","typesVersions":{"<3.6":{"*":["types-compat/ts-3.4/*"]},"<5.7":{"*":["types-compat/ts-5.6/*"]}},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/libflacjs_5.5.2_1784663807768_0.8409579449829052","host":"s3://npm-registry-packages-npm-production"}},"5.6.0":{"name":"libflacjs","version":"5.6.0","main":"index.js","description":"FLAC data stream encoder and decoder compiled in JavaScript using emscripten.","directories":{"doc":"doc","bin":"dist","example":"example","test":"tools/test"},"repository":{"type":"git","url":"git+https://github.com/mmig/libflac.js.git"},"license":"MIT","bugs":{"url":"https://github.com/mmig/libflac.js/issues"},"homepage":"https://github.com/mmig/libflac.js","keywords":["flac","audio","codec","encode","decode","emscripten","stream","metadata"],"typesVersions":{"<5.7":{"*":["types-compat/ts-5.6/*"]},"<3.6":{"*":["types-compat/ts-3.4/*"]}},"types":"./index.d.ts","bin":{"index.d.ts":"dist/index.d.ts","libflac.d.ts":"dist/libflac.d.ts","libflac.dev.d.ts":"dist/libflac.dev.d.ts","libflac.dev.js":"dist/libflac.dev.js","libflac.dev.js.symbols":"dist/libflac.dev.js.symbols","libflac.dev.wasm.d.ts":"dist/libflac.dev.wasm.d.ts","libflac.dev.wasm.js":"dist/libflac.dev.wasm.js","libflac.dev.wasm.js.symbols":"dist/libflac.dev.wasm.js.symbols","libflac.dev.wasm.wasm":"dist/libflac.dev.wasm.wasm","libflac.dev.wasm.wasm.map":"dist/libflac.dev.wasm.wasm.map","libflac.js":"dist/libflac.js","libflac.js.symbols":"dist/libflac.js.symbols","libflac.min.d.ts":"dist/libflac.min.d.ts","libflac.min.js":"dist/libflac.min.js","libflac.min.js.mem":"dist/libflac.min.js.mem","libflac.min.js.symbols":"dist/libflac.min.js.symbols","libflac.min.wasm.d.ts":"dist/libflac.min.wasm.d.ts","libflac.min.wasm.js":"dist/libflac.min.wasm.js","libflac.min.wasm.js.symbols":"dist/libflac.min.wasm.js.symbols","libflac.min.wasm.wasm":"dist/libflac.min.wasm.wasm","libflac.wasm.d.ts":"dist/libflac.wasm.d.ts","libflac.wasm.js":"dist/libflac.wasm.js","libflac.wasm.js.symbols":"dist/libflac.wasm.js.symbols","libflac.wasm.wasm":"dist/libflac.wasm.wasm"},"gitHead":"4c1bce76806d947de53af271c9dbb851913a633d","_id":"libflacjs@5.6.0","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-ev9pJxcPEkUdQDBd5ywPHEtYe9mGlzLaNwj+sS32IpiOTPnCYQsCPZLR95dAYXix24UICJJwld4D/tZrR0RFbw==","shasum":"08a23240b409d83d15a87894c1a2877f42da7134","tarball":"https://registry.npmjs.org/libflacjs/-/libflacjs-5.6.0.tgz","fileCount":192,"unpackedSize":8227405,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIELO/wXd7WwfXft/KHgOQ1vW5a/Q4cDuWk8/E8hi55gWAiBA7pzGAtljuacibJ4KYTq0rG9AXloJJlQdMjEHpFaGng=="}]},"_npmUser":{"name":"russa","email":"aaron.russ@dfki.de"},"maintainers":[{"name":"russa","email":"aaron.russ@dfki.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/libflacjs_5.6.0_1784665121956_0.22117330842453597"},"_hasShrinkwrap":false}},"time":{"created":"2019-11-28T22:05:13.101Z","modified":"2026-07-21T20:18:42.364Z","5.0.0":"2019-11-28T22:05:13.296Z","5.1.0":"2020-05-28T19:32:25.434Z","5.1.1":"2020-05-28T20:27:09.038Z","5.2.0":"2020-06-17T22:31:34.446Z","5.3.0":"2020-06-20T05:55:08.676Z","5.4.0":"2020-07-11T04:39:54.369Z","5.5.2":"2026-07-21T19:56:47.968Z","5.6.0":"2026-07-21T20:18:42.223Z"},"bugs":{"url":"https://github.com/mmig/libflac.js/issues"},"license":"MIT","homepage":"https://github.com/mmig/libflac.js","keywords":["flac","audio","codec","encode","decode","emscripten","stream","metadata"],"repository":{"type":"git","url":"git+https://github.com/mmig/libflac.js.git"},"description":"FLAC data stream encoder and decoder compiled in JavaScript using emscripten.","maintainers":[{"name":"russa","email":"aaron.russ@dfki.de"}],"readme":"[libflac.js][0]\r\n==========\r\n\r\n[![npm](https://img.shields.io/npm/v/libflacjs)](https://www.npmjs.com/package/libflacjs)\r\n[![GitHub package.json version](https://img.shields.io/github/package-json/v/mmig/libflac.js/master)][0]\r\n[![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/emscripten-core/emscripten?color=green&label=emscripten%40latest)][1]\r\n[![libFLAC version](https://img.shields.io/badge/libFLAC-1.3.3-yellow)][6]\r\n[![libogg version](https://img.shields.io/badge/libogg-1.3.4-yellow)][18]\r\n\r\n[FLAC][6] data stream encoder and decoder compiled to JavaScript using _emscripten_.\r\n\r\n__Features__  \r\n * available as pure JavaScript, JavaScript+_binary_, JavaScript+WASM\r\n * can be used in browsers as well as in `node.js`\r\n * encode/decode data all-at-once (~ _file_) or chunk-by-chunk (~ _stream_)\r\n * supported container formats: native FLAC container (`*.flac`), OGG container (`*.ogg`, `*.oga`)\r\n * support for FLAC metadata extraction when decoding (STREAMINFO, VORBIS_COMMENT, PICTURE, CUESHEET, SEEKTABLE)\r\n\r\n> Complied from `libFLAC` (static `C` library) version: 1.3.4\\\r\n> Used library `libogg` (static `C` library) version: 1.3.6\\\r\n> Used compiler `Emscripten` version: 1.39.19\\\r\n> Used compiler `Emscripten` toolchain: LLVM (upstream)\r\n\r\n----\r\n> __IMPORTANT__ changes for version `5.x`: simplified naming scheme and library location!  \r\n> See details in 'CHANGELOG.md'.\r\n----\r\n\r\n\r\n__Encoder Demo__  \r\nTry the [Encoding Demo][14] for encoding `*.wav` files to FLAC.\r\nOr try the [speech-to-flac][12] [demo][13] that encodes the audio stream from a microphone to FLAC.\r\n\r\n__Decoder Demo__  \r\nTry the [Decoding Demo][15] for decoding `*.flac` files to `*.wav` files.  \r\n_TODO_ example for decoding a FLAC audio stream (i.e. where data/size is not known beforehand).\r\n\r\n__API Documentation__  \r\nSee [doc/index.html][16] for the API documentation.\r\n\r\n\r\n\r\n----\r\n<!-- TOC depthFrom:2 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->\r\n\r\n- [Usage](#usage)\r\n\t- [Including libflac.js](#including-libflacjs)\r\n\t\t- [Browser](#browser)\r\n\t\t- [WebWorker](#webworker)\r\n\t\t- [Node](#node)\r\n\t\t- [React/webpack](#reactwebpack)\r\n\t\t- [Angular/webpack](#angularwebpack)\r\n\t\t- [WebWorker with webpack](#webworker-with-webpack)\r\n\t- [Async Initialization](#async-initialization)\r\n\t\t- [Including Dynamically Loaded libflac.js from Non-Default Location](#including-dynamically-loaded-libflacjs-from-non-default-location)\r\n\t\t- [Async Initialization with webpack](#async-initialization-with-webpack)\r\n\t- [Library Variants](#library-variants)\r\n\t\t- [_default_ vs `min` vs `dev`](#default-vs-min-vs-dev)\r\n\t\t- [`asm.js` vs `WASM`](#asmjs-vs-wasm)\r\n\t\t- [Example `WASM` Feature Detection](#example-wasm-feature-detection)\r\n\t\t- [Variants and Notes](#variants-and-notes)\r\n\t\t- [Default Library:](#default-library)\r\n\t\t- [Minified Library:](#minified-library)\r\n\t\t- [Development Library:](#development-library)\r\n\t- [Encoding with libflac.js](#encoding-with-libflacjs)\r\n\t\t- [Encoding Example](#encoding-example)\r\n\t\t- [Barebones Encoding Example](#barebones-encoding-example)\r\n\t- [Decoding with libflac.js](#decoding-with-libflacjs)\r\n\t\t- [Decoding Example](#decoding-example)\r\n\t\t- [Barebones Decoding Example](#barebones-decoding-example)\r\n\t\t- [Decoding Metadata Example](#decoding-metadata-example)\r\n\t- [API](#api)\r\n- [Building](#building)\r\n\t- [Build *nix (libflac 1.3.0 or later)](#build-nix-libflac-130-or-later)\r\n\t- [Changing The Library API](#changing-the-library-api)\r\n\t- [Legacy Build Instructions](#legacy-build-instructions)\r\n- [Contributors](#contributors)\r\n- [Acknowledgments](#acknowledgments)\r\n- [License](#license)\r\n\r\n<!-- /TOC -->\r\n\r\n## Usage\r\n------\r\n\r\n### Including libflac.js\r\n\r\nFor immediate use, the `/dist` sub-directory contains the compiled\r\nfiles for the `libflac.js` JavaScript library, as well as a _minified_\r\nversion and a _development_ (with additional/extend debug output) version.  \r\nFor more details, see section [Library Variants](#library-variants).\r\n\r\n#### Browser\r\n\r\nInclude the library file, e.g. if library file(s) `libflac.js` is in the same\r\ndirectory as the referencing HTML file:\r\n```html\r\n<script src=\"libflac.js\" type=\"text/javascript\"></script>\r\n```\r\n\r\n#### WebWorker\r\n\r\nImport the library file, e.g. if library file(s) `libflac.js` is in the same\r\ndirectory as the referencing worker script file:\r\n\r\n```javascript\r\nimportScripts('libflac.js');\r\n```\r\n\r\n#### Node\r\n\r\nIn `Node.js`:\r\ninstall with `npm`\r\n```bash\r\n # install from npm\r\nnpm install --save libflacjs\r\n\r\n # install latest from master branch\r\nnpm install --save git+https://github.com/mmig/libflac.js.git\r\n```\r\n\r\nthen, use factory method for loading one of the library variants:\r\n```javascript\r\n\r\n//load default/release asm.js variant:\r\nvar Flac = require('libflacjs')();\r\n\r\n// use one of the optimization-variants:\r\n//  * <empty> / \"release\"\r\n//  * \"min\"\r\n//  * \"dev\"\r\n// use one of the technology-variants:\r\n//  * <empty> / \"asmjs\"\r\n//  * \"wasm\"\r\n//\r\n// can be combined with dot, e.g. \"min.wasm\":\r\nvar FlacFactory = require('libflacjs');\r\nvar Flac = FlacFactory('min.wasm');\r\nFlac.on('ready', function(event){\r\n  ...\r\n```\r\n\r\nAlternatively, instead of loading via the factory method, the library variants\r\ncan also be `require`d directly:\r\n```javascript\r\n// for example:\r\nvar Flac = require('libflacjs/dist/libflac.js');\r\n// or e.g. the WASM variant:\r\nvar Flac = require('libflacjs/dist/libflac.wasm.js');\r\n```\r\n\r\n#### React/webpack\r\n\r\nFor `reactjs`:\r\ninstall with `npm` (see above), and `require()` the library file directly, like\r\n```javascript\r\n// for example:\r\nvar Flac = require('libflacjs/dist/libflac.js');\r\n// or e.g. the WASM variant:\r\nvar Flac = require('libflacjs/dist/libflac.wasm.js');\r\n```\r\n\r\n> NOTE `min` and `wasm` variants will most likely require\r\n>   additional configuration of the build system, see also\r\n>   section about [async `webpack` integration](#async-initialization-with-webpack)\r\n\r\n\r\n#### Angular/webpack\r\n\r\nFor `Angular` (`TypeScript`):\r\ninstall with `npm` (see above), and `import` the library file directly, like\r\n```typescript\r\n// for example:\r\nimport * as Flac from 'libflacjs/dist/libflac';\r\n// or e.g. the WASM variant:\r\nimport * as Flac from 'libflacjs/dist/libflac.wasm';\r\n```\r\n\r\n__NOTE__ unfortunately, current typings do not allow to set `Flac.onready` when imported this way.\r\n   This limitation can be worked around by casting to `any`, i.e.\r\n   ```typescript\r\n   (Flac.onready as any) = (evt: Flac.ReadyEvent) => console.log('Flac is ready now: ', evt.target);\r\n   ```\r\n   Or use `Flac.on('ready', ...` instead, or import with `require` statement, e.g. like\r\n   ```typescript\r\n   import * as FlacModule from 'libflacjs/dist/index.d';//import declaration file for typings\r\n\r\n   declare var require: Function;//NOTE most likely, the require function needs to be explicitly declared, if other envorinments than node are targeted\r\n\r\n   const Flac: typeof FlacModule = require('libflacjs/dist/libflac.js');\r\n   ```\r\n\r\n> NOTE `min` and `wasm` variants will most likely require\r\n>   additional configuration of the build system, see also\r\n>   section about [async `webpack` integration](#async-initialization-with-webpack)\r\n\r\n#### WebWorker with webpack\r\n\r\nWhen using `libflac.js` from a WebWorker in a `webpack` project, the `worker-loader` plugin is required, e.g. install with\r\n```bash\r\nnpm install --save-dev worker-loader\r\n```\r\n\r\nThen include a rule in the `webpack` configuration, so that the file with the `WebWorker` implementation will be built as a seperate script:  \r\nin the `module.rules` array add an entry, e.g. if the file name is `flacworker.js` something similar to\r\n```javascript\r\n{\r\n  //this must match the file-name of the worker script:\r\n  test:  /\\bflacworker\\.js$/i,\r\n  use: {\r\n    loader: 'worker-loader',\r\n    options: { name: 'worker-[name].[hash].js' }\r\n  }\r\n},\r\n```\r\n\r\nSee section [Async Initialization with webpack](#async-initialization-with-webpack)\r\nfor additional details, in case the included library variant includes a binary or `*.wasm` file.\r\n\r\nThen for creating the WebWorker instance use something like\r\n```javascript\r\n// var flacWorker = new Worker('flacworker.js'); //<- normal way to create a WebWorker instance\r\nvar flacWorker = require('./flacworker.js')();   //<- create a WebWorker instance with webpack worker-loader plugin\r\n\r\nflacWorker.onmessage = function(event) {\r\n console.log('received message from flacWorker ', event.data);\r\n}\r\n\r\nflacWorker.postMessage(...\r\n```\r\n\r\nIn the WebWorker script itself, do load the `libflac.js` library like\r\n```javascript\r\n//importScripts('libflac.js');//<- normal way to load a script within a WebWorker\r\n\r\n// for including a \"single file variant\" of libflac.js, e.g. the standard version:\r\nvar Flac = require('libflacjs/dist/libflac.js');\r\n\r\n// OR for including a .wasm variant, e.g standard-wasm (for binary of min-version include its *.mem file):\r\nrequire.resolve('libflacjs/dist/libflac.wasm.wasm') // <- force webpack to include the binary file\r\nvar Flac = require('libflacjs/dist/libflac.wasm.js')\r\n\r\nself.onmessage = function(event) {\r\n console.log('received message from main thread ', event.data);\r\n}\r\n```\r\n\r\n### Async Initialization\r\n\r\nIncluding dynamically loaded `libflac.js`:\r\n\r\nSome variants of the `libflac.js` library are loaded asynchronously\r\n(e.g. minimized/optimized variants may load a separate binary file during initialization of the library).\r\n\r\nIn this case, you have to make sure, not to use `libflac.js` before it has been completely loaded / initialized.\r\n\r\nCode example:\r\n```javascript\r\n\r\n//either use Flac.on() or set handler Flac.onready:\r\nFlac.on('ready', function(event){\r\n  var libFlac = event.target;\r\n  //NOTE: Flac === libFlac\r\n\r\n  //execute code that uses libflac.js:\r\n  someFunctionForProcessingFLAC();\r\n};\r\n\r\n//... or set handler\r\nFlac.onready = function(event){\r\n  var libFlac = event.target;\r\n  //NOTE: Flac === libFlac\r\n\r\n  //execute code that uses libflac.js:\r\n  someFunctionForProcessingFLAC();\r\n};\r\n\r\n\r\n// IMPORTANT: if execution environment does not support Object.defineProperty, then\r\n//            setting the handler will have no effect, if Flac is already initialized.\r\n//            In this case, the ready-state needs to be checked, and if already TRUE,\r\n//            the handler-code should be triggered immediately insteady of setting\r\n//            the handler.\r\nif( !Flac.isReady() ){\r\n  Flac.onready = function(event){\r\n    var libFlac = event.target;\r\n    //NOTE: Flac === libFlac\r\n\r\n    //call function that uses libflac.js:\r\n    someFunctionForProcessingFLAC();\r\n  };\r\n} else {\r\n\r\n  //execute code that uses libflac.js:\r\n  someFunctionForProcessingFLAC();\r\n}\r\n```\r\n\r\n**NOTE:** If `Object.defineProperty()` is not supported in the execution environment,\r\n         then the `onready()` handler will not be called, when the library already\r\n         has been initialized before assigning it to `Flac.onready` (i.e. when\r\n         `Flac.isReady()` returns `true`).\r\n         In this case, you should check `Flac.isReady()` and provide alternative code\r\n         execution to the `onready()` function, in case `Flac.isReady()` is `true`\r\n         (or use `Flac.on('ready', ...)` instead).\r\n\r\n\r\n#### Including Dynamically Loaded libflac.js from Non-Default Location\r\n\r\nVariants of the `libflac.js` library that are loaded asynchronously do usually also load some additional files.\r\n\r\nIf the library-file is not loaded from the default location (\"page root\"), but from a sub-directory/-path, you need to\r\nlet the library know, so that it searches for the additional files, that it needs to load, in that sub-directory/-path.\r\n\r\nFor this, the path/location must be stored in the global variable `FLAC_SCRIPT_LOCATION` *before* the `libflac.js`\r\nlibrary is loaded.\r\nIf `FLAC_SCRIPT_LOCATION` is given as `string`, it specifies the path to the `libflac.js` files (see examples below), e.g.\r\n```javascript\r\n//location example as string:\r\nFLAC_SCRIPT_LOCATION = 'libs/';\r\n```\r\nNote, that the path/location should end with a slash (`\"/\"`), e.g. `'some/path/'`\r\n_(however, the library will try to automatically add a slash, if it is missing)_.\r\n\r\nIf `FLAC_SCRIPT_LOCATION` is given as an object, it specifies mappings of the file-names to the file-paths of the `libflac.js` files (see examples below), e.g.\r\n```javascript\r\n//location example as object/mapping:\r\nFLAC_SCRIPT_LOCATION = {\r\n  'libflac.min.js.mem': 'libs/flac.mem'\r\n};\r\n```\r\n\r\nAn example for specifying the path/location at `libs/` in an HTML file:\r\n```html\r\n  <script type=\"text/javascript\">window.FLAC_SCRIPT_LOCATION = 'libs/';</script>\r\n  <script src=\"libs/libflac.js\" type=\"text/javascript\"></script>\r\n```\r\n\r\nOr example for specifying the path/location at `libs/` in a WebWorker script:\r\n```javascript\r\n  self.FLAC_SCRIPT_LOCATION = 'libs/';\r\n  importScripts('libs/libflac.js');\r\n```\r\n\r\nOr example for specifying the path/location at `libs/` in Node.js script:\r\n```javascript\r\n  process.env.FLAC_SCRIPT_LOCATION = './libs/';\r\n  var Flac = require('./libs/libflac.js');\r\n```\r\n\r\nExample for specifying custom path and file-name via mapping (`originalFileName -> <newPath/newFileName>`):  \r\nin this case, the file-name(s) of the additionally required files (e.g. `*.mem` or `.wasm` files)\r\nneed to be mapped to the custom path/file-name(s), that is,\r\nfor all the required files of the used library variant (see details below).\r\n```javascript\r\n  self.FLAC_SCRIPT_LOCATION = {\r\n    'libflac.min.js.mem': 'libs/flac.mem'\r\n  };\r\n  importScripts('libs/flac.min.js');\r\n```\r\n\r\n#### Async Initialization with webpack\r\n\r\nWhen using `libflac.js` in a `webpack` build process and a library variant with binary files\r\n(e.g. _min_ variant with `*.mem` files or _wasm_ variant with `*.wasm` files) is targeted,\r\nthen the `file-loader` plugin for `webpack` is required, e.g. install with\r\n```\r\nnpm install --save-dev file-loader\r\n```\r\n\r\nThen include a rule in the `webpack` configuration, so that the file with the binary files will be included with the correct file names that `libflac.js` expects:  \r\nin the `module.rules` array add an entry, e.g. if the file name is `flacworker.js` something similar to\r\n```javascript\r\n{\r\n  test: /\\.(wasm|mem)$/i,\r\n  use: {\r\n    loader: 'file-loader',\r\n    options: {\r\n      //NOTE binary file must be included with its original file name,\r\n      //     so that libflac.js lib can find it:\r\n      name: function(file) {\r\n        return path.basename(file)\r\n      }\r\n    }\r\n  },\r\n},\r\n```\r\n_Alternatively to using the exact file name of the binary files, `FLAC_SCRIPT_LOCATION` could be configured to use the file name generated by `file-loader` plugin, see details above for configuring `FLAC_SCRIPT_LOCATION`_\r\n\r\n\r\n### Library Variants\r\n\r\n#### _default_ vs `min` vs `dev`\r\n\r\nThere are multiple variants available for the library, that are compiled with different\r\nsettings for debug-output and code optimization, namely `debug`, `min`, and the\r\ndefault (release) library variants.\r\n\r\n#### `asm.js` vs `WASM`\r\n\r\nIn addition, for each of these variants, there is now a `wasm` variant (_WebAssembly_) available:\r\nthe old/default variants are compiled for `asm.js` which is \"normal\" JavaScript, with some\r\noptimizations that browsers can take advantage of by specifically supporting `asm.js` (e.g. _FireFox_).\r\n\r\n(from the [Emscripten documentation][17])\r\n> WebAssembly is a new binary format for executing code on the web, allowing much faster start times\r\n> (smaller download, much faster parsing in browsers)\r\n\r\nIn short, the (old) `asm.js` is backwards compatible, since it is simply JavaScript\r\n(and browsers that specifically support it, can execute it optimized/more efficiently),\r\nwhile the new `WebAssembly` format requires more recent/modern browsers, but is generally\r\nmore efficient with regard to code size and execution time.\r\n\r\n#### Example `WASM` Feature Detection\r\n\r\nsimple detection of `WASM` support in browser:\r\n```javascript\r\nvar Flac;\r\nif(typeof WebAssembly === 'object' && WebAssembly){\r\n  //load wasm-based library\r\n  Flac = require('libflac.min.wasm.js');\r\n  //or, for example, in worker script: importScripts('libflac.min.wasm.js');\r\n} else {\r\n  //load asm.js-based library\r\n  Flac = require('libflac.min.js');\r\n  //or, for example, in worker script: importScripts('libflac.min.js');\r\n}\r\n```\r\n\r\n#### Variants and Notes\r\n\r\n> NOTE the `WebAssembly` variant does not create/encode \"binary-perfect\" FLAC files\r\n     compared to the other library variants, or compared to the FLAC\r\n     command-line tool.  \r\n     More specifically, comparing the encoding results byte-by-byte with encoding\r\n     results from the `asm.js` variants, or separately encoded data using the FLAC\r\n     command-line tool, results are different for the `WebAssembly` variant.\r\n     However, the reverse operation, decoding these \"binary-different\" FLAC\r\n     files (using `WebAssembly`, or `asm.js` or the command-line tool) results\r\n     in the same WAV data again.  \r\n     _It seems, the `WebAssembly` variant chooses different frame-sizes\r\n       while encoding; e.g. the max. frame-size may differ from when encoding\r\n       with the `asm.js` variant or with the command-line tool._\r\n\r\nNOTES for dynamically loaded library variants:\r\n   * the corresponding _required_ files must be included in the same directory as the library/JavaScript file\r\n   * the additional _required_ files file must not be renamed (or the library/JavaScript file must be edited accordingly)\r\n   * see also the section above for handling dynamically loaded library variants, and, if appropriate, the section for\r\n     including dynamically loaded libraries from a sub-path/location\r\n\r\n#### Default Library:\r\n_(see [`/dist`](dist))_\r\n * ASM.js Variant:\r\n    * `libflac.js` (**required**)\r\n * WebAssembly variant _(dynamically loaded)_:\r\n    * `libflac.wasm.js` (**required**)\r\n    * `libflac.wasm.wasm` (**required**; will be loaded by the library)\r\n    * `libflac.wasm.js.symbols` (_optional_; contains renaming information)\r\n\r\n#### Minified Library:\r\n_(see [`/dist`](dist))_\r\n * ASM.js Variant _(dynamically loaded)_:\r\n     * `libflac.min.js` (**required**)\r\n     * `libflac.min.js.mem` (**required**; will be loaded by the library)\r\n     * `libflac.min.js.symbols` (optional; contains renaming information)\r\n * WebAssembly variant _(dynamically loaded)_:\r\n     * `libflac.min.wasm.js` (**required**)\r\n     * `libflac.min.wasm.wasm` (**required**; will be loaded by the library)\r\n     * `libflac.min.wasm.js.symbols` (_optional_; contains renaming information)\r\n\r\n#### Development Library:\r\n_(see [`/dist`](dist))_\r\n * ASM.js Variant:\r\n   * `libflac.dev.js` (**required**)\r\n   * ~~`libflac.dev.js.map` (_optional_; mapping to C code)~~ _currently not supported by LLVM toolchain_\r\n   * `libflac.dev.js.symbols` (_optional_; contains renaming information)\r\n * WebAssembly variant _(dynamically loaded)_:\r\n   * `libflac.dev.wasm.js` (**required**)\r\n   * `libflac.dev.wasm.wasm` (**required**; will be loaded by the library)\r\n   * `libflac.dev.wasm.js.map` (_optional_; mapping to C code)\r\n\r\n\r\n### Encoding with libflac.js\r\n\r\nGenerally, `libflac.js` supports a subset of the [libflac encoding interface][8] for encoding audio data to FLAC (no full support yet!).\r\n\r\nSupported encoding types:\r\n * encode from `PCM` data all-at-once\r\n * encode from `PCM` data chunk-by-chunk (i.e. _streaming_)\r\n\r\nSupported target containers:\r\n * native `FLAC` container\r\n * `OGG` transport container\r\n\r\nSee [example/encode.html][10] for a small example,\r\non how to encode a `WAV` file.\r\n\r\nFor a larger example on how to encode audio data from the\r\nmicrophone see the [Speech to FLAC][9] example.\r\n\r\nBasic steps for encoding:\r\n 1. create encoder\r\n   * specify encoding parameters, like channels, sampling rate, compression level etc.\r\n 2. initialize encoder\r\n   * for native FLAC container or OGG container\r\n   * specify write callback and/or other optional callback(s)\r\n 3. encode data (chunks)\r\n 4. finish encoding\r\n 5. delete encoder\r\n\r\n\r\n#### Encoding Example\r\n\r\nEncoding example using the utility class `Encoder`\r\n```javascript\r\n\r\nconst Flac = require('libflacjs')();\r\n//or as import (see section \"Including libflac.js\" for more details):\r\n// import * as flacFactory from 'libflacjs';\r\n// const Flac = flacFactory();\r\n\r\nconst Encoder = require('libflacjs/lib/encoder').Encoder;\r\n//or as import:\r\n//import { Encoder } from 'libflacjs/lib/encoder';\r\n\r\n//helper function for converting interleaved audio to list of channel-audio arrays\r\n//(for actual code, see example in tools/test/util/utils-enc.ts):\r\n//  function deinterleave(Int32Array, channels) => Int32Array[]\r\n\r\n//NOTE if async-library variant is used, should wait for initialization:\r\n//Flac.onready(function(){ ...\r\n\r\nconst data = new Int32Array(someAudioData);//<- someAudioData: PCM audio data converted to Int32Array samples\r\n\r\nconst encodingMode = 'interleaved';// \"interleaved\" | \"channels\"\r\n\r\nconst encoder = new Encoder(Flac, {\r\n  sampleRate: sampleRate,         // number, e.g. 44100\r\n  channels: channels,             // number, e.g. 1 (mono), 2 (stereo), ...\r\n  bitsPerSample: bitsPerSample,   // number, e.g. 8 or 16 or 24\r\n  compression: compressionLevel,  // number, value between [0, 8] from low to high compression\r\n  verify: true,                   // boolean (OPTIONAL)\r\n  isOgg: false                    // boolean (OPTIONAL), if encoded FLAC should be wrapped in OGG container\r\n});\r\n\r\nif(encodingMode === 'interleaved'){\r\n\r\n  //encode interleaved audio data (call multiple times for multiple audio chunks, i.e. \"streaming\")\r\n  encoder.encode(data);\r\n\r\n  //NOTE if data is TypedArray other than Int32Array then optional argument numberOfSamples MUST be given:\r\n  //encoder.encode(data, numberOfSamples);\r\n\r\n} else {\r\n\r\n  //if necessary, de-interleave data into channels-array\r\n  // i.e. a list/array of Int32Arrays, one for each channel (list.length corresponds to channels); see comments about function deinterleave above\r\n  const list = deinterleave(data, channels);// should return an list of Int32Arrays which's length corresponds to the number of channels\r\n\r\n  //do encode to FLAC (call multiple times for multiple audio chunks, i.e. \"streaming\")\r\n  encoder.encode(list);\r\n\r\n  //NOTE if data was TypedArray other than Int32Array then optional argument numberOfSamples MUST be given:\r\n  //encoder.encode(list, numberOfSamples);\r\n}\r\nencoder.encode();//<- finalize encoding by invoking encode() without arguments\r\n\r\n//get the encoded data:\r\nconst encData = encoder.getSamples();\r\nconst metadata = encoder.metadata;\r\n\r\nencoder.destroy();\r\n// or encoder.reset() for reusing the encoder instance\r\n\r\n// -> do something with the encoded FLAC data encData and metadata\r\n\r\n//    e.g. update header with final metadata & create FLAC file Blob:\r\nconst exportFlacFile = require('libflacjs/lib/utils').exportFlacFile;\r\nconst flacBlob = exportFlacFile(encData, metadata, /* if encode in OGG container: */ false);\r\n```\r\n\r\n\r\n#### Barebones Encoding Example\r\n\r\nEncoding example using the library functions directly\r\n\r\n```javascript\r\n\r\n//prerequisite: loaded libflac.js & available via variable Flac\r\n\r\n//NOTE if async-library variant is used, should wait for initialization:\r\n//Flac.onready(function(){ ...\r\n\r\nvar flac_encoder,\r\n    CHANNELS = 1,\r\n    SAMPLERATE = 44100,\r\n    COMPRESSION = 5,\r\n    BPS = 16,\r\n    VERIFY = false,\r\n    BLOCK_SIZE = 0,\r\n    flac_ok = 1,\r\n    USE_OGG = false;\r\n\r\n\r\n////////\r\n// [1] CREATE -> IN param: config { ... } (encoding parameters)\r\n\r\n//overwrite default configuration from config object\r\nCOMPRESSION = config.compression;\r\nBPS = config.bps;\r\nSAMPLERATE = config.samplerate;\r\nCHANNELS = config.channels;\r\nVERIFY = config.isVerify;//verification can be disabled for speeding up encoding process\r\nBLOCK_SIZE = config.blockSize;\r\nUSE_OGG = config.useOgg;\r\n\r\n//init encoder\r\nflac_encoder = Flac.create_libflac_encoder(SAMPLERATE, CHANNELS, BPS, COMPRESSION, 0, VERIFY, BLOCK_SIZE);\r\n\r\nif (flac_encoder == 0){\r\n  return;\r\n}\r\n\r\n////////\r\n// [2] INIT -> OUT: encBuffer (encoded data), metaData (OPTIONALLY, FLAC metadata)\r\n\r\n//for storing the encoded FLAC data\r\nvar encBuffer = [];\r\n//for storing the encoding FLAC metadata summary\r\nvar metaData;\r\n\r\n// [2] (a) setup writing (encoded) output data\r\n\r\nvar write_callback_fn = function(encodedData /*Uint8Array*/, bytes, samples, current_frame){\r\n  //store all encoded data \"pieces\" into a buffer\r\n  encBuffer.push(encodedData);\r\n};\r\n\r\n// [2] (b) optional callback for receiving metadata\r\n\r\nfunction metadata_callback_fn(data){\r\n  // data -> [example] {\r\n  //  min_blocksize: 4096,\r\n  //  max_blocksize: 4096,\r\n  //  min_framesize: 14,\r\n  //  max_framesize: 5408,\r\n  //  sampleRate: 44100,\r\n  //  channels: 2,\r\n  //  bitsPerSample: 16,\r\n  //  total_samples: 267776,\r\n  //  md5sum: \"50d4d469448e5ea75eb44ab6b7f111f4\"\r\n  //}\r\n  console.info('meta data: ', data);\r\n  metaData = data;\r\n}\r\n\r\n// [2] (c) initialize to either write to native-FALC or to OGG container\r\n\r\nvar status_encoder;\r\nif(!USE_OGG){\r\n  // encode to native FLAC container\r\n  status_encoder = Flac.init_encoder_stream(flac_encoder,\r\n    write_callback_fn,    //required callback(s)\r\n    metadata_callback_fn  //optional callback(s)\r\n  );\r\n} else {\r\n  // encode to OGG container\r\n  status_encoder = Flac.init_encoder_ogg_stream(flac_encoder,\r\n    write_callback_fn,    //required callback(s)\r\n    metadata_callback_fn  //optional callback(s)\r\n  );\r\n}\r\nflac_ok &= (status_encoder == 0);\r\n\r\n\r\n////////\r\n// [3] ENCODE -> IN: for this example, a PCM Float32 audio, single channel (mono) stream\r\n//                   buffer (Float32Array)\r\n// ... repeat encoding step [3] as often as necessary\r\n\r\n//convert input data to signed int data, in correspondence to the bps setting (i.e. in this case int32)\r\n// see API docs on FLAC__stream_encoder_process_interleaved() for more details\r\nvar buf_length = buffer.length;\r\nvar buffer_i32 = new Int32Array(buf_length);\r\nvar view = new DataView(buffer_i32.buffer);\r\nvar volume = 1;\r\nvar index = 0;\r\nfor (var i = 0; i < buf_length; i++){\r\n  view.setInt32(index, (buffer[i] * (0x7FFF * volume)), true);\r\n  index += 4;\r\n}\r\n\r\nvar flac_return = Flac.FLAC__stream_encoder_process_interleaved(flac_encoder, buffer_i32, buf_length);\r\nif (flac_return != true){\r\n  console.log(\"Error: FLAC__stream_encoder_process_interleaved returned false. \" + flac_return);\r\n}\r\n\r\n// encoding mode: either interleaved samples or array of channel-samples\r\nvar mode = 'interleaved';// \"interleaved\" | \"channels\"\r\n\r\n// do encode the audio data ...\r\nvar flac_return;\r\nif(mode === 'interleaved'){\r\n\r\n  //VARIANT 1: encode interleaved channels: TypedArray -> [ch1_sample1, ch2_sample1, ch1_sample1, ch2_sample2, ch2_sample3, ...\r\n\r\n  flac_return = Flac.FLAC__stream_encoder_process_interleaved(flac_encoder, buffer_i32, buf_length);\r\n\r\n} else {\r\n\r\n  //VARIANT 2: encode channels array: TypedArray[] -> [ [ch1_sample1, ch1_sample2, ch1_sample3, ...], [ch2_sample1, ch2_sample2, ch2_sample3, ...], ...]\r\n\r\n  //code example for splitting an interleaved Int32Array into its channels:\r\n  var ch_buf_i32 = new Array(CHANNELS).fill(null).map(function(){ return new Uint32Array(buf_length/CHANNELS); });\r\n  for(var i=0; i < buf_length; i += CHANNELS){\r\n    for(var j=0; j < CHANNELS; ++j){\r\n      ch_buf_i32[j][i / CHANNELS] = buffer_i32[i + j];\r\n    }\r\n  }\r\n\r\n  // ... encode the array of channel-data:\r\n  flac_return = Flac.FLAC__stream_encoder_process(flac_encoder, ch_buf_i32, buf_length / CHANNELS);\r\n}\r\n\r\n\r\n////////\r\n// [4] FINISH ENCODING\r\n\r\nflac_ok &= Flac.FLAC__stream_encoder_finish(flac_encoder);\r\nconsole.log(\"flac finish: \" + flac_ok);\r\n\r\n\r\n////////\r\n// [5] DESTROY: delete encoder\r\n\r\n//after usage: free up all resources for the encoder\r\nFlac.FLAC__stream_encoder_delete(flac_encoder);\r\n\r\n////////\r\n// [6] ... do something with the encoded data, e.g.\r\n//     merge \"encoded pieces\" in encBuffer into one single Uint8Array...\r\n\r\n```\r\n\r\n### Decoding with libflac.js\r\n\r\nGenerally, `libflac.js` supports a subset of the [libflac decoding interface][7] for decoding audio data from FLAC (no full support yet!).\r\n\r\nSupported decoding types:\r\n * decode from `FLAC` data to `PCM` data all-at-once\r\n * decode from `FLAC` data to `PCM` chunk-by-chunk (i.e. _streaming_)\r\n\r\nSupported source containers:\r\n * native `FLAC` container\r\n * `OGG` transport container\r\n\r\n\r\nSee [example/decode.html][11] for a small example,\r\non how to decode a `FLAC` file.\r\n\r\n\r\nBasic steps for decoding:\r\n 1. create decoder\r\n   * specify if checksum verification should be processed\r\n 2. initialize decoder\r\n   * specify if source is native FLAC container or OGG container\r\n   * specify read and write callback and/or other optional callback(s)\r\n 3. start decoding data (chunks)\r\n 4. finish decoding\r\n 5. delete decoder\r\n\r\n\r\n#### Decoding Example\r\n\r\nDecoding example using the utility class `Decoder`\r\n```javascript\r\n\r\nconst Flac = require('libflacjs')();\r\n//or as import (see section \"Including libflac.js\" for more details):\r\n// import * as flacFactory from 'libflacjs';\r\n// const Flac = flacFactory();\r\n\r\nconst Decoder = require('libflacjs/lib/decoder').Decoder;\r\n//or as import:\r\n//import { Decoder } from 'libflacjs/lib/decoder';\r\n\r\n//NOTE if async-library variant is used, should wait for initialization:\r\n//Flac.onready(function(){ ...\r\n\r\nconst binData = new Uint8Array(someFlacData);// <- someFlacData: binary FLAC data\r\n\r\nconst decodingMode = 'single';// \"single\" | \"chunked\"\r\n\r\nconst decoder = new Decoder(Flac, {\r\n  verify: true,   // boolean (OPTIONAL)\r\n  isOgg: false    // boolean (OPTIONAL), if FLAC audio is wrapped in OGG container\r\n});\r\n\r\nif(decodingMode === 'single'){\r\n\r\n  //use as-single-chunk mode: invoke decode once with the complete FLAC data\r\n  decoder.decode(binData);\r\n\r\n} else {\r\n\r\n  //use multiple-chunks mode (\"streaming\"): invoke decodeChunk(...) for each chunk...\r\n  decoder.decodeChunk(binData);\r\n  //... and finalize decoding by invoking decodeChunk() without arguments:\r\n  decoder.decodeChunk();\r\n}\r\n\r\n//get data as non-interleaved samples, i.e. array of channels data:\r\nconst decData = decoder.getSamples(/* return interleaved samples? */ false);// <- returns Uint8Array[]\r\n//or: get decoded data as interleaved samples:\r\n// const decData = decoder.getSamples(/* return interleaved samples? */ true);// <- returns Uint8Array\r\nconst metadata = decoder.metadata;\r\n\r\ndecoder.destroy();\r\n// or decoder.reset() for reusing the decoder instance\r\n\r\n// -> do something with the decoded PCM audio data decData and metadata\r\n\r\n//    e.g. create WAV file Blob:\r\nconst exportWavFile = require('libflacjs/lib/utils').exportWavFile;\r\nconst wavBlob = exportWavFile(encData, metadata.sampleRate, metadata.channels, metadata.bitsPerSample);\r\n```\r\n\r\n\r\n#### Barebones Decoding Example\r\n\r\nDecoding example using the library functions directly\r\n\r\n```javascript\r\n\r\n//prerequisite: loaded libflac.js & available via variable Flac\r\n\r\n//NOTE if async-library variant is used, should wait for initialization:\r\n//Flac.onready(function(){ ...\r\n\r\nvar VERIFY = true,\r\n  USE_OGG = false;\r\n\r\n\r\n////////\r\n// [1] CREATE -> IN: config { ... } (decoding parameters)\r\n\r\n//overwrite default configuration from config object\r\nVERIFY = config.isVerify;//verification can be disabled for speeding up decoding process\r\n\r\n//decode from native FLAC container or from OGG container\r\nUSE_OGG = config.isOgg;\r\n\r\n// create decoder\r\nvar flac_decoder = Flac.create_libflac_decoder(VERIFY);\r\n\r\nif (flac_decoder == 0){\r\n  return;\r\n}\r\n\r\n\r\n////////\r\n// [2] INIT -> OUT: decBuffer (decoded data), metaData (OPTIONALLY, FLAC metadata)\r\n//             IN: flacData Uint8Array (FLAC data)\r\n\r\n// [2] (a) setup reading input data\r\nvar currentDataOffset = 0;\r\nvar size = flacData.buffer.byteLength;\r\n\r\n//function that will be called for reading the input (FLAC) data:\r\nfunction read_callback_fn(bufferSize){\r\n\r\n  var end = currentDataOffset === size? -1 : Math.min(currentDataOffset + bufferSize, size);\r\n\r\n  var _buffer;\r\n  var numberOfReadBytes;\r\n  if(end !== -1){\r\n\r\n    _buffer = flacData.subarray(currentDataOffset, end);\r\n    numberOfReadBytes = end - currentDataOffset;\r\n\r\n    currentDataOffset = end;\r\n  } else {\r\n    //nothing left to read: return zero read bytes (indicates end-of-stream)\r\n    numberOfReadBytes = 0;\r\n  }\r\n\r\n  return {buffer: _buffer, readDataLength: numberOfReadBytes, error: false};\r\n}\r\n\r\n\r\n// [2] (b) setup writing (decoded) output data\r\n\r\n//for \"buffering\" the decoded data:\r\nvar decBuffer = [];\r\n//for storing the decoded FLAC metadata\r\nvar metaData;\r\n\r\n//function that will be called for decoded output data (WAV audio)\r\nfunction write_callback_fn(channelsBuffer, frameHeader){\r\n  // channelsBuffer is an Array of the decoded audio data (Uint8Array):\r\n  // the length of array corresponds to the channels, i.e. there is an Uint8Array for each channel\r\n\r\n  // frameHeader -> [example] {\r\n  //   bitsPerSample: 8\r\n  //   blocksize: 4096\r\n  //   channelAssignment: 0\r\n  //   channels: 2\r\n  //   crc: 0\r\n  //   number: 204800\r\n  //   numberType: \"samples\"\r\n  //   sampleRate: 44100\r\n  //   subframes: undefined // -> needs to be enabled via\r\n  //                       //     Flac.setOptions(flac_decoder, {analyseSubframes: true})\r\n  //                       // -> see API documentation\r\n  //}\r\n\r\n  decBuffer.push(channelsBuffer);\r\n}\r\n\r\n// [2] (c) optional callbacks for receiving details about errors and/or metadata\r\n\r\nfunction error_callback_fn(err, errMsg, client_data){\r\n  console.error('decode error callback', err, errMsg);\r\n}\r\n\r\nfunction metadata_callback_fn(data){\r\n  // data -> [example] {\r\n  //  min_blocksize: 4096,\r\n  //  max_blocksize: 4096,\r\n  //  min_framesize: 14,\r\n  //  max_framesize: 5408,\r\n  //  sampleRate: 44100,\r\n  //  channels: 2,\r\n  //  bitsPerSample: 16,\r\n  //  total_samples: 267776,\r\n  //  md5sum: \"50d4d469448e5ea75eb44ab6b7f111f4\"\r\n  //}\r\n  console.info('meta data: ', data);\r\n  metaData = data;\r\n}\r\n\r\n// [2] (d) intialize for reading from native-FLAC or from OGG container\r\nvar flac_ok = 1;\r\nvar status_decoder;\r\nif(!USE_OGG){\r\n  // decode from native FLAC container\r\n  status_decoder = Flac.init_decoder_stream(\r\n    flac_decoder,\r\n    read_callback_fn, write_callback_fn,     //required callback(s)\r\n    error_callback_fn, metadata_callback_fn  //optional callback(s)\r\n  );\r\n} else {\r\n  // decode from OGG container\r\n  status_decoder = Flac.init_decoder_ogg_stream(\r\n    flac_decoder,\r\n    read_callback_fn, write_callback_fn,     //required callback(s)\r\n    error_callback_fn, metadata_callback_fn  //optional callback(s)\r\n  );\r\n}\r\nflac_ok &= status_decoder == 0;\r\n\r\nif(flac_ok != 1){\r\n  return;\r\n}\r\n\r\n////////\r\n// [3] DECODE -> IN: FLAC audio data (see above, the read-callack)\r\n// ... repeat encoding step [3] as often as necessary\r\n\r\n// example for chunk-by-chunk (stream mode) or all-at-once decoding (file mode)\r\nvar mode = 'stream';// 'stream' | 'file'\r\n\r\nvar state = 0;\r\nvar flac_return = 1;\r\n\r\nif(mode == 'stream'){\r\n\r\n  // VARIANT 1: decode chunks of flac data, one-by-one\r\n\r\n  //request to decode data chunks until end-of-stream is reached:\r\n  while(state <= 3 && flac_return != false){\r\n\r\n    flac_return &= Flac.FLAC__stream_decoder_process_single(flac_decoder);\r\n    state = Flac.FLAC__stream_decoder_get_state(flac_decoder);\r\n  }\r\n\r\n  flac_ok &= flac_return != false;\r\n\r\n} else if(mode == 'file'){\r\n\r\n  // VARIANT 2: decode complete data stream, all-at-once\r\n  flac_return &= Flac.FLAC__stream_decoder_process_until_end_of_stream(flac_decoder);\r\n\r\n  //optionally: retrieve status\r\n  state = Flac.FLAC__stream_decoder_get_state(flac_decoder);\r\n}\r\n\r\n\r\nif (flac_return != true){\r\n  return;\r\n}\r\n\r\n////////\r\n// [4] FINISH DECODING\r\n\r\n// finish Decoding\r\nflac_ok &= Flac.FLAC__stream_decoder_finish(flac_decoder);\r\n\r\n////////\r\n// [5] DESTROY: delete dencoder\r\n// alternatively reset the decoder, and then re-initialize for re-using the decoder instance\r\n\r\n//after usage: free up all resources for the decoder\r\nFlac.FLAC__stream_decoder_delete(flac_decoder);\r\n\r\n////////\r\n// [6] ... do something with the decoded data, e.g.\r\n//     merge \"decoded pieces\" in decBuffer into a single data stream and add WAV header...\r\n\r\n```\r\n\r\n\r\n#### Decoding Metadata Example\r\n\r\nExample for extracting metadata when decoding FLAC audio\r\n\r\n```javascript\r\n\r\n// prerequisites: loaded & initialized Flac library\r\n\r\n//... create decoder flacDecoder (see code examples above)\r\n\r\n//enable all metadata types:\r\nFlac.FLAC__stream_decoder_set_metadata_respond_all(flacDecoder);\r\n\r\n//or enable only seek table metadata:\r\nFlac.FLAC__stream_decoder_set_metadata_respond(flacDecoder, 3);\r\n// example seek table metadata (see docs for details):\r\n// {\r\n//   num_points: 1,\r\n//   points: [{\r\n//     frame_samples: 4096,\r\n//     sample_number: 0,\r\n//     stream_offset: 0\r\n//   }]\r\n// }\r\n\r\n//or enable only vorbis comment metadata:\r\nFlac.FLAC__stream_decoder_set_metadata_respond(flacDecoder, 4);\r\n// example vorbis comment metadata:\r\n// {\r\n//   vendor_string: \"reference libFLAC 1.3.3 20190804\",\r\n//   num_comments: 1,\r\n//   comments: [\"TRACKNUMBER=2/9\"]\r\n// }\r\n\r\n//or enable only cue sheet metadata:\r\nFlac.FLAC__stream_decoder_set_metadata_respond(flacDecoder, 5);\r\n// example cue sheet metadata (see docs for details):\r\n// {\r\n//   is_cd: 0,\r\n//   lead_in: 88200,\r\n//   media_catalog_number: \"1234567890123\",\r\n//   num_tracks: 2,\r\n//   tracks: [{\r\n//     isrc: \"\",\r\n//     num_indices: 1,\r\n//     indices: [{offset: 0, number: 1}],\r\n//     number: 1,\r\n//     offset: 0,\r\n//     pre_emphasis: false,\r\n//     type: \"AUDIO\"\r\n//   }, {\r\n//     isrc: \"\",\r\n//     num_indices: 0,\r\n//     indices: [],\r\n//     number: 170,\r\n//     offset: 267776,\r\n//     pre_emphasis: false,\r\n//     type: \"AUDIO\"\r\n//   }]\r\n// }\r\n\r\n//or enable only all picture metadata:\r\nFlac.FLAC__stream_decoder_set_metadata_respond(flacDecoder, 6);\r\n// example picture metadata:\r\n// {\r\n//   type: 3,            // image type (see docs FLAC__StreamMetadata_Picture_Type)\r\n//   mime_type: \"image/jpeg\",  //the mime type\r\n//   description: \"Cover image for the track\",\r\n//   width: 1144,        // the image width in pixel\r\n//   height: 1144,       // the image height in pixel\r\n//   depth: 24,          // the depth in bits\r\n//   colors: 0,          // colors (e.g. for GIF images)\r\n//   data_length: 45496, // the size of the binary image data (in bytes)\r\n//   data: Uint8Array    // the binary image data\r\n// }\r\n\r\n\r\n\r\n//the metadata callback which stores the metadata in a list:\r\nvar streamMetadata, metadataList = [];\r\nfunction metadata_callback_fn(data, dataBlock){\r\n  if(data){\r\n    // the stream metadata:\r\n    streamMetadata = data;\r\n  } else {\r\n    // other metadata types:\r\n    metadataList.push(dataBlock);\r\n\r\n    // dataBlock[example]:\r\n    // {\r\n    //   data: METADATA, // the metadata, e.g. stream info, seek table, vorbis comment, picture,...\r\n    //   isLast: 0,      // wether the metadata block is the last block befor the audio data\r\n    //   length: 1032,   // the length/size of the metadata (in byte)\r\n    //   type: 4,        // metadata type, [0, 6] (higher metadata types are as of yet UNKNOWN)\r\n    // }\r\n  }\r\n}\r\n\r\n//... initilize decoder flacDecoder with metadata_callback_fn,\r\n//    and decode flac data (see code examples above)\r\n\r\n```\r\n\r\n### API\r\n\r\nSee the [doc/index.html][16] for the API documentation.\r\n\r\n## Building\r\n------\r\n\r\nBuilding libflac.js requires that [emscripten][1] is installed and configured.\r\n\r\nSee the [emscripten documentation][3] and its [main site][2] for\r\nan introduction, tutorials etc.\r\n\r\nFor changing the targeted libflac version, modify the `Makefile`:\r\n```\r\n...\r\nFLAC_VERSION:=1.3.2\r\n...\r\n```\r\n\r\n### Build *nix (libflac 1.3.0 or later)\r\n\r\nIn order to build _libflac.js_, make sure you have _emscripten_ installed (with toolchain `LLVM/upstream`; default toolchain since version 1.39.x).\r\n\r\nWhen running `make`, the build process will download the sources for the\r\n`FLAC` and `OGG` libraries, extract them, and build the JavaScript version of libflac.\r\n\r\nIf necessary, activate the appropriate `emscripten` toolchain (e.g. `llvm` or the older `fastcomp` toolchain; default is `llvm`)\r\n```bash\r\n # list versions\r\nemsdk list\r\n\r\n # activate a specific version with llvm toolchain\r\n # NOTE update Makefile if necessary with selected toolchain\r\n #   TOOL_CHAIN:=$(TOOL_CHAIN_LLVM)\r\nemsdk activate <version>\r\n\r\n\r\n # activate a specific version with fastcomp toolchain\r\n # NOTE update Makefile if necessary with selected toolchain\r\n #   TOOL_CHAIN:=$(TOOL_CHAIN_FASTCOMP)\r\nemsdk activate <version>-fastcomp\r\n```\r\n\r\n> NOTE when activating a toolchain, `emsdk` will print some information on how to set the correct enviornment variables, e.g.\r\n> ```\r\n>   ...\r\n>   To conveniently access the selected set of tools from the command line,\r\n>   consider adding the following directories to PATH,\r\n>   or call 'source <path>/emsc/emsdk_env.sh' to do this for you.\r\n>   ...\r\n> ```\r\n> _even when not changing a toolset via `emsdk activate ...` you may need to update/export\r\n> the variables for the emsdk toolchain_\r\n\r\n\r\nStart build process by executing the `Makefile`:\r\n```bash\r\nmake\r\n```\r\n(build process was tested on Unbuntu 18.04)\r\n\r\n### Changing The Library API\r\n\r\nThe API for _libflac.js_ (e.g. exported functions) are mainly specified in `libflac_post.js`.\r\n\r\nFunctions that will be exported/used from the native `libflac` implementation need to be declared in\r\nthe compile option `-s EXPORTED_FUNCTIONS='[...]'` (see variable `EMCC_OPTS:=...` in `Makefile`);\r\nnote, when manually editing `EXPORTED_FUNCTIONS`, that the function-names must be prefixed with `_`, i.e. for\r\nfunction `the_function`, the string for the exported function would be `_the_function`.\r\n\r\nThere is a [helper script](tools/extract_EXPORTED_FUNCTIONS.js) that will try to extract the compile option from `libflac_post.js` (i.e. the list of functions that need to be declared).\r\nRun the script with `Node.js` in `tools/` (and copy&paste the output value):\r\n```\r\ncd tools\r\nnode extract_EXPORTED_FUNCTIONS.js\r\n```\r\n\r\nIMPORTANT: the helper script extracts function names that are invoked by `Module.ccall()`\r\n          or `Module.cwrap()`.\r\n          If invoked dynamically (i.e. use of variable instead of string), add a DEV comment\r\n          where the function is explicitly stated as string, e.g.\r\n```javascript\r\n//DEV comment for exported-functions script:\r\n//  Module.ccall('FLAC__stream_decoder_init_stream'\r\n//  Module.ccall('FLAC__stream_decoder_init_ogg_stream'\r\nvar func_name = test? 'FLAC__stream_decoder_init_stream' : 'FLAC__stream_decoder_init_ogg_stream';\r\nModule.ccall(\r\n  func_name,\r\n```\r\n\r\n### Legacy Build Instructions\r\n\r\nFor more details and/or build instructions for older `libflac.js` versions, see\r\n[CHANGELOG.md][19]\r\n\r\n## Contributors\r\n------\r\n\r\nSee `CONTRIBUTORS` for list of contributors.\r\n\r\n## Acknowledgments\r\n------\r\n\r\nThis project was inspired by Krennmair's [libmp3lame-js][5] project for [JS mp3][5] encoding.\r\n\r\n\r\n## License\r\n-------\r\n\r\nlibflac.js is compiled from the reference implementation of FLAC (BSD license);\r\nthe additional resources and wrapper-code of this project is published under the MIT license (see file LICENSE).\r\n\r\n[0]: https://github.com/mmig/libflac.js\r\n[1]: https://github.com/kripken/emscripten\r\n[2]: https://kripken.github.io/emscripten-site\r\n[3]: https://kripken.github.io/emscripten-site/docs\r\n[4]: https://kripken.github.io/emscripten-site/docs/getting_started/getting_started_with_emscripten_and_vs2010.html\r\n[5]: https://github.com/akrennmair/libmp3lame-js\r\n[6]: https://xiph.org/flac/\r\n[7]: https://xiph.org/flac/api/group__flac__stream__decoder.html\r\n[8]: https://xiph.org/flac/api/group__flac__stream__encoder.html\r\n[9]: https://github.com/mmig/speech-to-flac\r\n[10]: example/encode.html\r\n[11]: example/decode.html\r\n[12]: https://github.com/mmig/speech-to-flac\r\n[13]: https://mmig.github.io/speech-to-flac/\r\n[14]: https://mmig.github.io/libflac.js/example/encode.html\r\n[15]: https://mmig.github.io/libflac.js/example/decode.html\r\n[16]: https://mmig.github.io/libflac.js/doc/\r\n[17]: http://kripken.github.io/emscripten-site/docs/compiling/WebAssembly.html#webassembly\r\n[18]: https://xiph.org/ogg/\r\n[19]: https://github.com/mmig/libflac.js/blob/master/CHANGELOG.md\r\n","readmeFilename":"README.md"}