diff --git a/README.md b/README.md index c4b80fb..a4c3db0 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,9 @@ https://github.com/rochars/riff-chunks [![NPM version](https://img.shields.io/npm/v/riff-chunks.svg?style=for-the-badge)](https://www.npmjs.com/package/riff-chunks) [![Docs](https://img.shields.io/badge/docs-online-blue.svg?style=for-the-badge)](https://rochars.github.io/riff-chunks/index.html) [![Codecov](https://img.shields.io/codecov/c/github/rochars/riff-chunks.svg?style=flat-square)](https://codecov.io/gh/rochars/riff-chunks) [![Unix Build](https://img.shields.io/travis/rochars/riff-chunks.svg?style=flat-square)](https://travis-ci.org/rochars/riff-chunks) [![Windows Build](https://img.shields.io/appveyor/ci/rochars/riff-chunks.svg?style=flat-square&logo=appveyor)](https://ci.appveyor.com/project/rochars/riff-chunks) [![Scrutinizer](https://img.shields.io/scrutinizer/g/rochars/riff-chunks.svg?style=flat-square&logo=scrutinizer)](https://scrutinizer-ci.com/g/rochars/riff-chunks/) +## About +Read and write the chunks of RIFF files. + ## Install ``` npm install riff-chunks diff --git a/compile.js b/compile.js new file mode 100644 index 0000000..6582313 --- /dev/null +++ b/compile.js @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2017-2018 Rafael da Silva Rocha. + * https://github.com/rochars/riff-chunks + * + */ + +const riffChunks = require("./index.js"); + +window['riffChunks'] = window['riffChunks'] ? window['riffChunks'] : {}; +window['riffChunks']['read'] = riffChunks.read; +window['riffChunks']['write'] = riffChunks.write; \ No newline at end of file diff --git a/dist/riff-chunks-min.js b/dist/riff-chunks-min.js index 5cc881d..0f10d80 100644 --- a/dist/riff-chunks-min.js +++ b/dist/riff-chunks-min.js @@ -1,41 +1,13 @@ -/* - riff-chunks - Read and write the chunks of RIFF and RIFX files. - Copyright (c) 2017 Rafael da Silva Rocha. - https://github.com/rochars/riff-chunks - - byte-data - Pack and unpack binary data. - Copyright (c) 2017-2018 Rafael da Silva Rocha. - https://github.com/rochars/byte-data - - generic-integer - Pack and unpack any integer from 1 to 53-Bit. - Copyright (c) 2018 Rafael da Silva Rocha. - https://github.com/rochars/generic-integer - - endianness - Swap endianness in byte arrays. - Copyright (c) 2017 Rafael da Silva Rocha. - https://github.com/rochars/endianness - -*/ -var n="function"==typeof Object.create?Object.create:function(a){function e(){}e.prototype=a;return new e},p;if("function"==typeof Object.setPrototypeOf)p=Object.setPrototypeOf;else{var q;a:{var r={H:!0},t={};try{t.__proto__=r;q=t.H;break a}catch(a){}q=!1}p=q?function(a,e){a.__proto__=e;if(a.__proto__!==e)throw new TypeError(a+" is not extensible");return a}:null}var u=p; -function v(a,e){a.prototype=n(e.prototype);a.prototype.constructor=a;if(u)u(a,e);else for(var c in e)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(e,c);d&&Object.defineProperty(a,c,d)}else a[c]=e[c];a.Ba=e.prototype} -for(var w="function"==typeof Object.defineProperties?Object.defineProperty:function(a,e,c){a!=Array.prototype&&a!=Object.prototype&&(a[e]=c.value)},x="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,y=["Object","assign"],z=0;z>10;var b=a&1023;return(f?Math.pow(2,f-15)*(1+b/1024):b/1024*.00006103515625)*(a>>15?-1:1)};d.prototype.N=function(a,f){g[0]=this.read(a,f,{bits:32,offset:4});return k[0]};d.prototype.O=function(a,f){var c=new d({bits:32,offset:4});h[0]=c.read(a,f,{bits:32, -offset:4});h[1]=c.read(a,f+4,{bits:32,offset:4});return b[0]};d.prototype.P=function(a,f){for(var b="",c=0;c>16&32768;var h=c>>12&2047;c=c>>23&255;103<=c&&(f=(f|c-112<<10|h>>1)+(h&1));a[b++]=f&255; -a[b++]=f>>>8&255;return b};d.prototype.aa=function(a,f,b){a[b++]=f.charCodeAt(0);return b};d.prototype.I=function(){this.S();this.T();this.s&&(this.min=-Infinity,this.max=Infinity)};d.prototype.S=function(){this.s?16==this.b?this.h=this.M:32==this.b?this.h=this.N:64==this.b&&(this.h=this.O):this.char&&(this.h=this.P)};d.prototype.T=function(){this.s?16==this.b?this.i=this.Y:32==this.b?this.i=this.Z:64==this.b&&(this.i=this.$):this.char&&(this.i=this.aa)};a.a=d},function(a,e,c){function d(a){m.j="RIFX"=== -a.chunkId;var b=h.v(a.chunkId,l).concat(h.D(a.chunkSize,m),h.v(a.format,l),k(a.subChunks));if("RIFF"===a.chunkId||"RIFX"===a.chunkId)b=new Uint8Array(b);return b}function k(a){for(var b=[],c=0;c>>0;return this.f(this.u(c))};e.prototype.write=function(a,d,e){d=this.f(d);var c=255;e=this.X(a,d,void 0===e?0:e);for(var b=2;b<=this.offset;b++)b==this.offset&&(c=this.o),a[e++]=Math.floor(d/Math.pow(2, -8*(b-1)))&c;return e};e.prototype.B=function(a,d){d=void 0===d?0:d;for(var c="",e=0;ethis.b?1:Math.ceil(this.g/8)};e.prototype.u=function(a){a>this.max&&(a-=2*this.max+2);return a};e.prototype.f=function(a){a>this.max?a=this.max:athis.b||64this.b?a[e++]=0>d?d+Math.pow(2,this.b):d:a[e++]=d&255;return e};a.a=e},function(a){a.a=function(a,c){for(var d=a.length,e=0;e>10;var c=a&1023;return(b?Math.pow(2,b-15)*(1+c/1024):c/1024*.00006103515625)*(a>>15?-1:1)}function g(a,b){v[0]=l.read(a,b);return w[0]}function h(a,b){q[0]=l.read(a,b);q[1]=l.read(a,b+4);return x[0]}function e(a,b){for(var c="",m=0;m>16&32768;var d=m>>12&2047;m=m>>23&255;103<= +m&&(b=(b|m-112<<10|d>>1)+(d&1));a[c++]=b&255;a[c++]=b>>>8&255;return c}function u(a,b,c){w[0]=b;return c=l.write(a,v[0],c)}function z(a,b,c){x[0]=b;c=l.write(a,q[0],c);return l.write(a,q[1],c)}function A(a,b,c){a[c++]=b.charCodeAt(0);return c}var y=b(4),r=b(5);c=new Int8Array(4);var v=new Int32Array(c.buffer,0,1),w=new Float32Array(c.buffer,0,1);c=new Int8Array(8);var x=new Float64Array(c.buffer),q=new Uint32Array(c.buffer),n,p,l;a.a.o=function(a,b){for(var c=0,d=[],f=0;fa.bits?1:Math.ceil(a.bits/8);a.base=b;a["float"]?16==a.bits?n=f:32==a.bits?n=g:64==a.bits&&(n=h):a["char"]?n=e:n=d;a["float"]?16==a.bits?p=t:32==a.bits?p=u:64==a.bits&&(p=z):a["char"]?p=A:p=k;l=a["float"]?64==a.bits?new r(32,!1):32==a.bits?new r(32,!0):new r(16,!1):new r(a.bits,a.signed)}},function(a){a.a=function(a,b){for(var c=a.length,f=0;f>>0;return this.f(this.l(b))};c.prototype.write=function(a,c,f){c=this.f(c);var b=255;f=this.K(a,c,void 0===f?0:f);for(var d=2;d<=this.offset;d++)d==this.offset&&(b=this.j),a[f++]=Math.floor(c/Math.pow(2,8*(d-1)))&b;return f};c.prototype.v=function(a, +c){c=void 0===c?0:c;for(var b="",d=0;dthis.b?1:Math.ceil(this.h/8)};c.prototype.l=function(a){a>this.max&&(a-=2*this.max+2);return a};c.prototype.f=function(a){a>this.max?a=this.max:athis.b||64this.b?a[f++]=0>c?c+Math.pow(2,this.b):c:a[f++]=c&255;return f};a.a=c}]); \ No newline at end of file diff --git a/dist/riff-chunks.js b/dist/riff-chunks.js deleted file mode 100644 index be7a9b3..0000000 --- a/dist/riff-chunks.js +++ /dev/null @@ -1,1239 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 1); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - -/* - * type: The Type class. - * Copyright (c) 2017 Rafael da Silva Rocha. - * https://github.com/rochars/byte-data - */ - -/** @private */ -let f32 = new Float32Array(1); -/** @private */ -let i32 = new Int32Array(f32.buffer); -/** @private */ -let f64 = new Float64Array(1); -/** @private */ -let ui32 = new Uint32Array(f64.buffer); -let GenericInteger = __webpack_require__(4); - -/** - * A class to represent byte-data types. - */ -class Type extends GenericInteger { - - /** - * @param {Object} options The type definition. - * @param {number} options.bits Number of bits used by data of this type. - * @param {boolean} options.char True for string/char types. - * @param {boolean} options.float True for float types. - * Available only for 16, 32 and 64-bit data. - * @param {boolean} options.base The base: 2, 10 or 16. - * @param {boolean} options.be True for big-endian. - * @param {boolean} options.signed True for signed types. - */ - constructor(options) { - super(options); - /** - * If this type is a char or not. - * @type {boolean} - */ - this.char = options["char"]; - /** - * If this type is a floating-point number or not. - * @type {boolean} - */ - this.float = options["float"]; - /** - * The base used to represent data of this type. - * Default is 10. - * @type {number} - */ - this.base = options["base"] ? options["base"] : 10; - this.buildType_(); - } - - /** - * Read 1 16-bit float from from bytes. - * Thanks https://stackoverflow.com/a/8796597 - * @param {!Array|Uint8Array} bytes An array of bytes. - * @param {number} i The index to read. - * @return {number} - * @private - */ - read16F_(bytes, i) { - let int = this.read(bytes, i, {"bits": 16, "offset": 2}); - let exponent = (int & 0x7C00) >> 10; - let fraction = int & 0x03FF; - let floatValue; - if (exponent) { - floatValue = Math.pow(2, exponent - 15) * (1 + fraction / 0x400); - } else { - floatValue = 6.103515625e-5 * (fraction / 0x400); - } - return floatValue * (int >> 15 ? -1 : 1); - } - - /** - * Read 1 32-bit float from bytes. - * @param {!Array|Uint8Array} bytes An array of bytes. - * @param {number} i The index to read. - * @return {number} - * @private - */ - read32F_(bytes, i) { - i32[0] = this.read(bytes, i, {"bits": 32, "offset": 4}); - return f32[0]; - } - - /** - * Read 1 64-bit double from bytes. - * Thanks https://gist.github.com/kg/2192799 - * @param {!Array|Uint8Array} bytes An array of bytes. - * @param {number} i The index to read. - * @return {number} - * @private - */ - read64F_(bytes, i) { - let type32 = new Type({"bits": 32, "offset": 4}); - ui32[0] = type32.read(bytes, i, {"bits": 32, "offset": 4}); - ui32[1] = type32.read(bytes, i + 4, {"bits": 32, "offset": 4}); - return f64[0]; - } - - /** - * Read 1 char from bytes. - * @param {!Array|Uint8Array} bytes An array of bytes. - * @param {number} i The index to read. - * @return {string} - * @private - */ - readChar_(bytes, i) { - let chrs = ""; - let j = 0; - while(j < this.offset) { - chrs += String.fromCharCode(bytes[i+j]); - j++; - } - return chrs; - } - - /** - * Write one 64-bit float as a binary value. - * @param {!Array} bytes An array of bytes. - * @param {number} number The number to write as bytes. - * @param {number} j The index being written in the byte buffer. - * @return {number} The next index to write on the byte buffer. - * @private - */ - write64F_(bytes, number, j) { - f64[0] = number; - let type = new Type({"bits": 32, "offset": 4, "lastByteMask":255}); - j = type.write(bytes, ui32[0], j); - return type.write(bytes, ui32[1], j); - } - - /** - * Write one 32-bit float as a binary value. - * @param {!Array} bytes An array of bytes. - * @param {number} number The number to write as bytes. - * @param {number} j The index being written in the byte buffer. - * @return {number} The next index to write on the byte buffer. - * @private - */ - write32F_(bytes, number, j) { - f32[0] = number; - j = this.write(bytes, i32[0], j); - return j; - } - - /** - * Write one 16-bit float as a binary value. - * @param {!Array} bytes An array of bytes. - * @param {number} number The number to write as bytes. - * @param {number} j The index being written in the byte buffer. - * @return {number} The next index to write on the byte buffer. - * @private - */ - write16F_(bytes, number, j) { - f32[0] = number; - let x = i32[0]; - let bits = (x >> 16) & 0x8000; - let m = (x >> 12) & 0x07ff; - let e = (x >> 23) & 0xff; - if (e >= 103) { - bits |= ((e - 112) << 10) | (m >> 1); - bits += m & 1; - } - bytes[j++] = bits & 0xFF; - bytes[j++] = bits >>> 8 & 0xFF; - return j; - } - - /** - * Write one char as a byte. - * @param {!Array} bytes An array of bytes. - * @param {string} string The string to write as bytes. - * @param {number} j The index being written in the byte buffer. - * @return {number} The next index to write on the byte buffer. - * @private - */ - writeChar_(bytes, string, j) { - bytes[j++] = string.charCodeAt(0); - return j; - } - - /** - * Build the type. - * @private - */ - buildType_() { - this.setReader_(); - this.setWriter_(); - if (this.float) { - this.min = -Infinity; - this.max = Infinity; - } - } - - /** - * Set the function to read data of this type. - * @private - */ - setReader_() { - if (this.float) { - if (this.bits == 16) { - this.reader = this.read16F_; - } else if(this.bits == 32) { - this.reader = this.read32F_; - } else if(this.bits == 64) { - this.reader = this.read64F_; - } - } else if (this.char) { - this.reader = this.readChar_; - } - } - - /** - * Set the function to write data of this type. - * @private - */ - setWriter_() { - if (this.float) { - if (this.bits == 16) { - this.writer = this.write16F_; - } else if(this.bits == 32) { - this.writer = this.write32F_; - } else if(this.bits == 64) { - this.writer = this.write64F_; - } - } else if (this.char) { - this.writer = this.writeChar_; - } - } -} - -module.exports = Type; - - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - -/*! - * riff-chunks - * Read and write the chunks of RIFF and RIFX files. - * Copyright (c) 2017 Rafael da Silva Rocha. - * https://github.com/rochars/riff-chunks - * - */ - -/** @private */ -const byteData = __webpack_require__(2); -/** @private */ -const chr = byteData.chr; -/** @private */ -let uInt32 = byteData.uInt32; - - -/** - * Write the bytes of a RIFF/RIFX file. - * @param {Object} chunks A structure like the return of riffChunks.read(). - * @return {Uint8Array} The file bytes as Uint8Array when - * chunkId is "RIFF" or "RIFX" or the chunk bytes as Array - * when chunkId is "LIST". - */ -function write(chunks) { - uInt32.be = chunks["chunkId"] === "RIFX"; - let bytes = - byteData.packArray(chunks["chunkId"], chr).concat( - byteData.pack(chunks["chunkSize"], uInt32), - byteData.packArray(chunks["format"], chr), - writeSubChunks_(chunks["subChunks"]) - ); - if (chunks["chunkId"] === "RIFF" || chunks["chunkId"] === "RIFX" ) { - bytes = new Uint8Array(bytes); - } - return bytes; -} - -/** - * Get the chunks of a RIFF/RIFX file. - * @param {Uint8Array|Array} buffer The file bytes. - * @return {Object} The chunk. - */ -function read(buffer) { - buffer = [].slice.call(buffer); - let chunkId = getChunkId_(buffer, 0); - uInt32.be = chunkId === "RIFX"; - return { - "chunkId": chunkId, - "chunkSize": getChunkSize_(buffer, 0), - "format": byteData.unpackArray(buffer.slice(8, 12), chr), - "subChunks": getSubChunks_(buffer) - }; -} - -/** - * Write the sub chunks of a RIFF file. - * @param {Array} chunks The chunks. - * @return {Array} The chunk bytes. - * @private - */ -function writeSubChunks_(chunks) { - let subChunks = []; - let i = 0; - while (i < chunks.length) { - if (chunks[i]["chunkId"] === "LIST") { - subChunks = subChunks.concat(write(chunks[i])); - } else { - subChunks = subChunks.concat( - byteData.packArray(chunks[i]["chunkId"], chr), - byteData.pack(chunks[i]["chunkSize"], uInt32), - chunks[i]["chunkData"] - ); - } - i++; - } - return subChunks; -} - -/** - * Get the sub chunks of a RIFF file. - * @param {Uint8Array|Array} buffer the RIFF file bytes. - * @return {Object} The subchunks of a RIFF/RIFX or LIST chunk. - * @private - */ -function getSubChunks_(buffer) { - let chunks = []; - let i = 12; - while(i < buffer.length) { - chunks.push(getSubChunk_(buffer, i)); - i += 8 + chunks[chunks.length - 1]["chunkSize"]; - } - return chunks; -} - -/** - * Get a sub chunk from a RIFF file. - * @param {Uint8Array|Array} buffer the RIFF file bytes. - * @param {number} index The start index of the chunk. - * @return {Object} A subchunk of a RIFF/RIFX or LIST chunk. - * @private - */ -function getSubChunk_(buffer, index) { - let chunk = { - "chunkId": getChunkId_(buffer, index), - "chunkSize": getChunkSize_(buffer, index) - }; - if (chunk["chunkId"] === "LIST") { - chunk["format"] = byteData.unpackArray(buffer.slice(8, 12), chr); - chunk["subChunks"] = getSubChunks_( - buffer.slice(index, index + chunk["chunkSize"])); - } else { - chunk["chunkData"] = buffer.slice( - index + 8, index + 8 + chunk["chunkSize"]); - } - return chunk; -} - -/** - * Return the FourCC of a chunk. - * @param {Uint8Array|Array} buffer the RIFF file bytes. - * @param {number} index The start index of the chunk. - * @return {string} The id of the chunk. - * @private - */ -function getChunkId_(buffer, index) { - return byteData.unpackArray(buffer.slice(index, index + 4), chr); -} - -/** - * Return the size of a chunk. - * @param {Uint8Array|Array} buffer the RIFF file bytes. - * @param {number} index The start index of the chunk. - * @return {number} The size of the chunk without the id and size fields. - * @private - */ -function getChunkSize_(buffer, index) { - return byteData.unpack(buffer.slice(index + 4, index + 8), uInt32); -} - -window['riffChunks'] = window['riffChunks'] || {};window['riffChunks']['read'] = read; -window['riffChunks']['write'] = write; - - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -/*! - * byte-data - * Pack and unpack binary data. - * Copyright (c) 2017-2018 Rafael da Silva Rocha. - * https://github.com/rochars/byte-data - * - */ - -/** @private */ -const rw = __webpack_require__(3); -const Type = __webpack_require__(0); - -/** - * Turn a number or fixed-length string into a byte buffer. - * @param {number|string} value The value. - * @param {Object} type One of the available types. - * @param {number} base The base of the output. Optional. Default is 10. - * Possible values are 2, 10 or 16. - * @return {!Array|!Array} - */ -function pack(value, type, base=10) { - let values = []; - if (type.char) { - values = type.char ? value.slice(0, type.offset) : value; - } else if (!Array.isArray(value)) { - values = [value]; - } - return rw.toBytes(values, rw.getType(type, base)); -} - -/** - * Turn a byte buffer into a number or a fixed-length string. - * @param {!Array|!Array|Uint8Array} buffer An array of bytes. - * @param {Object} type One of the available types. - * @param {number} base The base of the input. Optional. Default is 10. - * Possible values are 2, 10 or 16. - * @return {number|string} - */ -function unpack(buffer, type, base=10) { - let values = rw.fromBytes( - buffer.slice(0, type.offset), - rw.getType(type, base) - ); - if (type.char) { - values = values.slice(0, type.bits / 8); - } else { - values = values[0]; - } - return values; -} - -/** - * Turn a array of numbers or a string into a byte buffer. - * @param {!Array|string} values The values. - * @param {Object} type One of the available types. - * @param {number} base The base of the output. Optional. Default is 10. - * Possible values are 2, 10 or 16. - * @return {!Array|!Array} - */ -function packArray(values, type, base=10) { - return rw.toBytes(values, rw.getType(type, base)); -} - -/** - * Turn a byte buffer into a array of numbers or a string. - * @param {!Array|!Array|Uint8Array} buffer The byte array. - * @param {Object} type One of the available types. - * @param {number} base The base of the input. Optional. Default is 10. - * Possible values are 2, 10 or 16. - * @return {!Array|string} - */ -function unpackArray(buffer, type, base=10) { - return rw.fromBytes(buffer, rw.getType(type, base)); -} - -/** - * Find and return the start index of some string. - * Return -1 if the string is not found. - * @param {!Array|Uint8Array} buffer A byte buffer. - * @param {string} text Some string to look for. - * @return {number} The start index of the first occurrence, -1 if not found - */ -function findString(buffer, text) { - let found = ""; - for (let i = 0; i < buffer.length; i++) { - found = unpack( - buffer.slice(i, i + text.length + 1), - new Type({"bits": text.length * 8, "char": true}) - ); - if (found == text) { - return i; - } - } - return -1; -} - -/** - * Turn a struct into a byte buffer. - * A struct is an array of values of not necessarily the same type. - * @param {Array} struct The struct values. - * @param {!Array} def The struct type definition. - * @param {number} base The base of the output. Optional. Default is 10. - * Possible values are 2, 10 or 16. - * @return {!Array|!Array} - */ -function packStruct(struct, def, base=10) { - if (struct.length < def.length) { - return []; - } - let bytes = []; - for (let i = 0; i < def.length; i++) { - bytes = bytes.concat(pack(struct[i], def[i], base)); - } - return bytes; -} - -/** - * Turn a byte buffer into a struct. - * A struct is an array of values of not necessarily the same type. - * @param {!Array|!Array|Uint8Array} buffer The byte buffer. - * @param {!Array} def The struct type definition. - * @param {number} base The base of the input. Optional. Default is 10. - * Possible values are 2, 10 or 16. - * @return {Array} - */ -function unpackStruct(buffer, def, base=10) { - if (buffer.length < getStructDefSize(def)) { - return []; - } - let struct = []; - let i = 0; - let j = 0; - while (i < def.length) { - struct = struct.concat( - unpack(buffer.slice(j, j + def[i].offset), def[i], base) - ); - j += def[i].offset; - i++; - } - return struct; -} - -/** - * Get the length in bytes of a struct definition. - * @param {!Array} def The struct type definition. - * @return {number} The length of the structure in bytes. - * @private - */ -function getStructDefSize(def) { - let bits = 0; - for (let i = 0; i < def.length; i++) { - bits += def[i].offset; - } - return bits; -} - -// interface -module.exports.pack = pack; -module.exports.unpack = unpack; -module.exports.packArray = packArray; -module.exports.unpackArray = unpackArray; -module.exports.unpackStruct = unpackStruct; -module.exports.packStruct = packStruct; -module.exports.findString = findString; -module.exports.Type = Type; -/** - * A char. - * @type {Object} - */ -module.exports.chr = new Type({"bits": 8, "char": true}); -/** - * A 4-char string - * @type {Object} - */ -module.exports.fourCC = new Type({"bits": 32, "char": true}); -/** - * Booleans - * @type {Object} - */ -module.exports.bool = new Type({"bits": 1}); -/** - * Signed 2-bit integers - * @type {Object} - */ -module.exports.int2 = new Type({"bits": 2, "signed": true}); -/** - * Unsigned 2-bit integers - * @type {Object} - */ -module.exports.uInt2 = new Type({"bits": 2}); -/** - * Signed 4-bit integers - * @type {Object} - */ -module.exports.int4 = new Type({"bits": 4, "signed": true}); -/** - * Unsigned 4-bit integers - * @type {Object} - */ -module.exports.uInt4 = new Type({"bits": 4}); -/** - * Signed 8-bit integers - * @type {Object} - */ -module.exports.int8 = new Type({"bits": 8, "signed": true}); -/** - * Unsigned 4-bit integers - * @type {Object} - */ -module.exports.uInt8 = new Type({"bits": 8}); -// LE -/** - * Signed 16-bit integers little-endian - * @type {Object} - */ -module.exports.int16 = new Type({"bits": 16, "signed": true}); -/** - * Unsigned 16-bit integers little-endian - * @type {Object} - */ -module.exports.uInt16 = new Type({"bits": 16}); -/** - * Half-precision floating-point numbers little-endian - * @type {Object} - */ -module.exports.float16 = new Type({"bits": 16, "float": true}); -/** - * Signed 24-bit integers little-endian - * @type {Object} - */ -module.exports.int24 = new Type({"bits": 24, "signed": true}); -/** - * Unsigned 24-bit integers little-endian - * @type {Object} - */ -module.exports.uInt24 = new Type({"bits": 24}); -/** - * Signed 32-bit integers little-endian - * @type {Object} - */ -module.exports.int32 = new Type({"bits": 32, "signed": true}); -/** - * Unsigned 32-bit integers little-endian - * @type {Object} - */ -module.exports.uInt32 = new Type({"bits": 32}); -/** - * Single-precision floating-point numbers little-endian - * @type {Object} - */ -module.exports.float32 = new Type({"bits": 32, "float": true}); -/** - * Signed 40-bit integers little-endian - * @type {Object} - */ -module.exports.int40 = new Type({"bits": 40, "signed": true}); -/** - * Unsigned 40-bit integers little-endian - * @type {Object} - */ -module.exports.uInt40 = new Type({"bits": 40}); -/** - * Signed 48-bit integers little-endian - * @type {Object} - */ -module.exports.int48 = new Type({"bits": 48, "signed": true}); -/** - * Unsigned 48-bit integers little-endian - * @type {Object} - */ -module.exports.uInt48 = new Type({"bits": 48}); -/** - * Double-precision floating-point numbers little-endian - * @type {Object} - */ -module.exports.float64 = new Type({"bits": 64, "float": true}); -// BE -/** - * Signed 16-bit integers big-endian - * @type {Object} - */ -module.exports.int16BE = new Type({"bits": 16, "signed": true, "be": true}); -/** - * Unsigned 16-bit integers big-endian - * @type {Object} - */ -module.exports.uInt16BE = new Type({"bits": 16, "be": true}); -/** - * Half-precision floating-point numbers big-endian - * @type {Object} - */ -module.exports.float16BE = new Type({"bits": 16, "float": true, "be": true}); -/** - * Signed 24-bit integers big-endian - * @type {Object} - */ -module.exports.int24BE = new Type({"bits": 24, "signed": true, "be": true}); -/** - * Unsigned 24-bit integers big-endian - * @type {Object} - */ -module.exports.uInt24BE = new Type({"bits": 24, "be": true}); -/** - * Signed 32-bit integers big-endian - * @type {Object} - */ -module.exports.int32BE = new Type({"bits": 32, "signed": true, "be": true}); -/** - * Unsigned 32-bit integers big-endian - * @type {Object} - */ -module.exports.uInt32BE = new Type({"bits": 32, "be": true}); -/** - * Single-precision floating-point numbers big-endian - * @type {Object} - */ -module.exports.float32BE = new Type({"bits": 32, "float": true, "be": true}); -/** - * Signed 40-bit integers big-endian - * @type {Object} - */ -module.exports.int40BE = new Type({"bits": 40, "signed": true, "be": true}); -/** - * Unsigned 40-bit integers big-endian - * @type {Object} - */ -module.exports.uInt40BE = new Type({"bits": 40, "be": true}); -/** - * Signed 48-bit integers big-endian - * @type {Object} - */ -module.exports.int48BE = new Type({"bits": 48, "signed": true, "be": true}); -/** - * Unsigned 48-bit integers big-endian - * @type {Object} - */ -module.exports.uInt48BE = new Type({"bits": 48, "be": true}); -/** - * Double-precision floating-point numbers big-endian - * @type {Object} - */ -module.exports.float64BE = new Type({"bits": 64, "float": true, "be": true}); - - -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { - -/* - * Copyright (c) 2017 Rafael da Silva Rocha. - * https://github.com/rochars/byte-data - */ - -const Type = __webpack_require__(0); -const endianness = __webpack_require__(5); - -/** - * Turn a byte buffer into what the bytes represent. - * @param {!Array|!Array|Uint8Array} buffer An array of bytes. - * @param {Object} type One of the available types. - * @return {!Array|number|string} - */ -function fromBytes(buffer, type) { - if (type.be) { - endianness(buffer, type.offset); - } - if (type.base != 10) { - bytesFromBase(buffer, type.base); - } - return readBytes(buffer, type); -} - -/** - * Turn numbers and strings to bytes. - * @param {!Array|number|string} values The data. - * @param {Object} type One of the available types. - * @return {!Array|!Array} the data as a byte buffer. - */ -function toBytes(values, type) { - let bytes = writeBytes(values, type); - if (type.be) { - endianness(bytes, type.offset); - } - if (type.base != 10) { - bytesToBase(bytes, type.base); - formatOutput(bytes, type); - } - return bytes; -} - -/** - * Turn a array of bytes into an array of what the bytes should represent. - * @param {!Array|Uint8Array} bytes An array of bytes. - * @param {Object} type The type. - * @return {!Array|string} - */ -function readBytes(bytes, type) { - let values = []; - let i = 0; - let len = bytes.length - (type.offset - 1); - while (i < len) { - values.push(type.reader(bytes, i)); - i += type.offset; - } - if (type.char) { - values = values.join(""); - } - return values; -} - -/** - * Write values as bytes. - * @param {!Array|number|string} values The data. - * @param {Object} type One of the available types. - * @return {!Array} the bytes. - */ -function writeBytes(values, type) { - let i = 0; - let j = 0; - let len = values.length; - let bytes = []; - while (i < len) { - j = type.writer(bytes, values[i++], j); - } - return bytes; -} - -/** - * Get the full type spec for the reading/writing. - * @param {Object} type One of the available types. - * @param {number} base The base of the input. - * @return {Object} - */ -function getType(type, base) { - let theType = Object.assign(new Type({}), type); - theType.base = base; - return theType; -} - -/** - * Turn bytes to base 10 from base 2 or 16. - * @param {!Array|Uint8Array} bytes The bytes as binary or hex strings. - * @param {number} base The base. - */ -function bytesFromBase(bytes, base) { - let i = 0; - let len = bytes.length; - while(i < len) { - bytes[i] = parseInt(bytes[i], base); - i++; - } -} - -/** - * Turn the output to the correct base. - * @param {Array} bytes The bytes. - * @param {Object} type The type. - */ -function formatOutput(bytes, type) { - let i = 0; - let len = bytes.length; - let offset = (type.base == 2 ? 8 : 2) + 1; - while(i < len) { - bytes[i] = Array(offset - bytes[i].length).join("0") + bytes[i]; - i++; - } -} - -/** - * Turn bytes from base 10 to base 2 or 16. - * @param {!Array|Array} bytes The bytes. - * @param {number} base The base. - */ -function bytesToBase(bytes, base) { - let i = 0; - let len = bytes.length; - while (i < len) { - bytes[i] = bytes[i].toString(base); - i++; - } -} - -module.exports.getType = getType; -module.exports.toBytes = toBytes; -module.exports.fromBytes = fromBytes; - - -/***/ }), -/* 4 */ -/***/ (function(module, exports) { - -/*! - * generic-integer - * Pack and unpack any integer from 1 to 53-Bit. - * Copyright (c) 2018 Rafael da Silva Rocha. - * https://github.com/rochars/generic-integer - * - */ - -/** - * A class to read and write any integer from 1 to 53-Bit. - */ -class GenericInteger { - - /** - * @param {Object} options The type definition. - * @param {number} options.bits Number of bits used by the data. - * @param {boolean} options.be True for big-endian. - * @param {boolean} options.signed True for signed types. - */ - constructor(options) { - /** - * The max number of bits used by the data. - * @type {number} - */ - this.bits = options["bits"]; - /** - * If this type is big-endian or not. - * @type {boolean} - */ - this.be = options["be"]; - /** - * If this type it is signed or not. - * @type {boolean} - */ - this.signed = options["signed"]; - /** - * The function to read values from buffers. - * @type {Function} - */ - this.reader = this.read; - /** - * The function to write values to buffers. - * @type {Function} - */ - this.writer = this.write; - /** - * The number of bytes used by the data. - * @type {number} - */ - this.offset = 0; - /** - * Min value for numbers of this type. - * @type {number} - */ - this.min = -Infinity; - /** - * Max value for numbers of this type. - * @type {number} - */ - this.max = Infinity; - /** - * The practical number of bits used by the data. - * @type {number} - * @private - */ - this.realBits_ = this.bits; - /** - * The mask to be used in the last byte. - * @type {number} - * @private - */ - this.lastByteMask_ = 255; - this.build_(); - } - - /** - * Read one integer number from a byte buffer. - * @param {!Array|Uint8Array} bytes An array of bytes. - * @param {number} i The index to read. - * @return {number} - */ - read(bytes, i=0) { - if (this.bits > 32) { - return this.readBits_(bytes, i); - } - let num = 0; - let x = this.offset - 1; - while (x > 0) { - num = (bytes[x + i] << x * 8) | num; - x--; - } - num = (bytes[i] | num) >>> 0; - return this.overflow_(this.sign_(num)); - } - - /** - * Write one integer number to a byte buffer. - * @param {!Array} bytes An array of bytes. - * @param {number} number The number. - * @param {number} j The index being written in the byte buffer. - * @return {number} The next index to write on the byte buffer. - */ - write(bytes, number, j=0) { - number = this.overflow_(number); - let mask = 255; - j = this.writeFirstByte_(bytes, number, j); - for (let i = 2; i <= this.offset; i++) { - if (i == this.offset) { - mask = this.lastByteMask_; - } - bytes[j++] = Math.floor(number / Math.pow(2, ((i - 1) * 8))) & mask; - } - return j; - } - - /** - * Read a integer number from a byte buffer by turning int bytes - * to a string of bits. Used for data with more than 32 bits. - * @param {!Array|Uint8Array} bytes An array of bytes. - * @param {number} i The index to read. - * @return {number} - * @private - */ - readBits_(bytes, i=0) { - let binary = ""; - let j = 0; - while(j < this.offset) { - let bits = bytes[i + j].toString(2); - binary = Array(9 - bits.length).join("0") + bits + binary; - j++; - } - return this.overflow_(this.sign_(parseInt(binary, 2))); - } - - /** - * Build the type. - * @private - */ - build_() { - this.validateWordSize_(); - this.setRealBits_(); - this.setLastByteMask_(); - this.setMinMax_(); - this.offset = this.bits < 8 ? 1 : Math.ceil(this.realBits_ / 8); - } - - /** - * Sign a number. - * @param {number} num The number. - * @return {number} - * @private - */ - sign_(num) { - if (num > this.max) { - num -= (this.max * 2) + 2; - } - return num; - } - - /** - * Limit the value according to the bit depth in case of - * overflow or underflow. - * @param {number} value The data. - * @return {number} - * @private - */ - overflow_(value) { - if (value > this.max) { - value = this.max; - } else if (value < this.min) { - value = this.min; - } - return value; - } - - /** - * Set the minimum and maximum values for the type. - * @private - */ - setMinMax_() { - let max = Math.pow(2, this.bits); - if (this.signed) { - this.max = max / 2 -1; - this.min = -max / 2; - } else { - this.max = max - 1; - this.min = 0; - } - } - - /** - * Validate the number of bits. - * @private - */ - validateWordSize_() { - if (this.bits < 1 || this.bits > 64) { - throw Error("Not a supported type."); - } - } - - /** - * Set the practical bit number for data with bit count different - * from the standard types (8, 16, 32, 40, 48, 64) and more than 8 bits. - * @private - */ - setRealBits_() { - if (this.bits > 8) { - this.realBits_ = ((this.bits - 1) | 7) + 1; - } - } - - /** - * Set the mask that should be used when writing the last byte. - * @private - */ - setLastByteMask_() { - let r = 8 - (this.realBits_ - this.bits); - this.lastByteMask_ = Math.pow(2, r > 0 ? r : 8) -1; - } - - /** - * Write the first byte of a integer number. - * @param {!Array} bytes An array of bytes. - * @param {number} number The number. - * @param {number} j The index being written in the byte buffer. - * @return {number} The next index to write on the byte buffer. - * @private - */ - writeFirstByte_(bytes, number, j) { - if (this.bits < 8) { - bytes[j++] = number < 0 ? number + Math.pow(2, this.bits) : number; - } else { - bytes[j++] = number & 255; - } - return j; - } -} - -module.exports = GenericInteger; - - -/***/ }), -/* 5 */ -/***/ (function(module, exports) { - -/*! - * endianness - * Swap endianness in byte arrays. - * Copyright (c) 2017 Rafael da Silva Rocha. - * https://github.com/rochars/endianness - * - */ - -/** - * Swap the endianness of units of information in a byte array. - * The original array is modified in-place. - * @param {!Array|!Array|Uint8Array} bytes The bytes. - * @param {number} offset The number of bytes of each unit of information. - */ -function endianness(bytes, offset) { - let len = bytes.length; - let i = 0; - while (i < len) { - swap(bytes, offset, i); - i += offset; - } -} - -/** - * Swap the endianness of a unit of information in a byte array. - * The original array is modified in-place. - * @param {!Array|!Array|Uint8Array} bytes The bytes. - * @param {number} offset The number of bytes of the unit of information. - * @param {number} index The start index of the unit of information. - */ -function swap(bytes, offset, index) { - let x = 0; - let y = offset - 1; - let limit = parseInt(offset / 2, 10); - while(x < limit) { - let theByte = bytes[index + x]; - bytes[index + x] = bytes[index + y]; - bytes[index + y] = theByte; - x++; - y--; - } -} - -module.exports = endianness; - - -/***/ }) -/******/ ]); \ No newline at end of file diff --git a/docs/fonts/OpenSans-Bold-webfont.eot b/docs/fonts/OpenSans-Bold-webfont.eot deleted file mode 100644 index 5d20d91..0000000 Binary files a/docs/fonts/OpenSans-Bold-webfont.eot and /dev/null differ diff --git a/docs/fonts/OpenSans-Bold-webfont.svg b/docs/fonts/OpenSans-Bold-webfont.svg deleted file mode 100644 index 3ed7be4..0000000 --- a/docs/fonts/OpenSans-Bold-webfont.svg +++ /dev/null @@ -1,1830 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/fonts/OpenSans-Bold-webfont.woff b/docs/fonts/OpenSans-Bold-webfont.woff deleted file mode 100644 index 1205787..0000000 Binary files a/docs/fonts/OpenSans-Bold-webfont.woff and /dev/null differ diff --git a/docs/fonts/OpenSans-BoldItalic-webfont.eot b/docs/fonts/OpenSans-BoldItalic-webfont.eot deleted file mode 100644 index 1f639a1..0000000 Binary files a/docs/fonts/OpenSans-BoldItalic-webfont.eot and /dev/null differ diff --git a/docs/fonts/OpenSans-BoldItalic-webfont.svg b/docs/fonts/OpenSans-BoldItalic-webfont.svg deleted file mode 100644 index 6a2607b..0000000 --- a/docs/fonts/OpenSans-BoldItalic-webfont.svg +++ /dev/null @@ -1,1830 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/fonts/OpenSans-BoldItalic-webfont.woff b/docs/fonts/OpenSans-BoldItalic-webfont.woff deleted file mode 100644 index ed760c0..0000000 Binary files a/docs/fonts/OpenSans-BoldItalic-webfont.woff and /dev/null differ diff --git a/docs/fonts/OpenSans-Italic-webfont.eot b/docs/fonts/OpenSans-Italic-webfont.eot deleted file mode 100644 index 0c8a0ae..0000000 Binary files a/docs/fonts/OpenSans-Italic-webfont.eot and /dev/null differ diff --git a/docs/fonts/OpenSans-Italic-webfont.svg b/docs/fonts/OpenSans-Italic-webfont.svg deleted file mode 100644 index e1075dc..0000000 --- a/docs/fonts/OpenSans-Italic-webfont.svg +++ /dev/null @@ -1,1830 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/fonts/OpenSans-Italic-webfont.woff b/docs/fonts/OpenSans-Italic-webfont.woff deleted file mode 100644 index ff652e6..0000000 Binary files a/docs/fonts/OpenSans-Italic-webfont.woff and /dev/null differ diff --git a/docs/fonts/OpenSans-Light-webfont.eot b/docs/fonts/OpenSans-Light-webfont.eot deleted file mode 100644 index 1486840..0000000 Binary files a/docs/fonts/OpenSans-Light-webfont.eot and /dev/null differ diff --git a/docs/fonts/OpenSans-Light-webfont.svg b/docs/fonts/OpenSans-Light-webfont.svg deleted file mode 100644 index 11a472c..0000000 --- a/docs/fonts/OpenSans-Light-webfont.svg +++ /dev/null @@ -1,1831 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/fonts/OpenSans-Light-webfont.woff b/docs/fonts/OpenSans-Light-webfont.woff deleted file mode 100644 index e786074..0000000 Binary files a/docs/fonts/OpenSans-Light-webfont.woff and /dev/null differ diff --git a/docs/fonts/OpenSans-LightItalic-webfont.eot b/docs/fonts/OpenSans-LightItalic-webfont.eot deleted file mode 100644 index 8f44592..0000000 Binary files a/docs/fonts/OpenSans-LightItalic-webfont.eot and /dev/null differ diff --git a/docs/fonts/OpenSans-LightItalic-webfont.svg b/docs/fonts/OpenSans-LightItalic-webfont.svg deleted file mode 100644 index 431d7e3..0000000 --- a/docs/fonts/OpenSans-LightItalic-webfont.svg +++ /dev/null @@ -1,1835 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/fonts/OpenSans-LightItalic-webfont.woff b/docs/fonts/OpenSans-LightItalic-webfont.woff deleted file mode 100644 index 43e8b9e..0000000 Binary files a/docs/fonts/OpenSans-LightItalic-webfont.woff and /dev/null differ diff --git a/docs/fonts/OpenSans-Regular-webfont.eot b/docs/fonts/OpenSans-Regular-webfont.eot deleted file mode 100644 index 6bbc3cf..0000000 Binary files a/docs/fonts/OpenSans-Regular-webfont.eot and /dev/null differ diff --git a/docs/fonts/OpenSans-Regular-webfont.svg b/docs/fonts/OpenSans-Regular-webfont.svg deleted file mode 100644 index 25a3952..0000000 --- a/docs/fonts/OpenSans-Regular-webfont.svg +++ /dev/null @@ -1,1831 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/docs/fonts/OpenSans-Regular-webfont.woff b/docs/fonts/OpenSans-Regular-webfont.woff deleted file mode 100644 index e231183..0000000 Binary files a/docs/fonts/OpenSans-Regular-webfont.woff and /dev/null differ diff --git a/docs/global.html b/docs/global.html index c84a7d0..50d8ce9 100644 --- a/docs/global.html +++ b/docs/global.html @@ -127,7 +127,7 @@

readSource:
@@ -285,7 +285,7 @@

writeSource:
@@ -441,7 +441,7 @@
Returns:

- Documentation generated by JSDoc 3.5.5 on Thu Apr 26 2018 10:35:18 GMT-0300 (Hora oficial do Brasil) using the docdash theme. + Documentation generated by JSDoc 3.5.5 on Thu May 03 2018 23:19:51 GMT-0300 (Hora oficial do Brasil) using the docdash theme.
diff --git a/docs/index.html b/docs/index.html index c17fd55..a6bdff4 100644 --- a/docs/index.html +++ b/docs/index.html @@ -48,6 +48,7 @@

Home

Global

  • riff-chunks

    Read and write the chunks of RIFF and RIFX files.
    Copyright (c) 2017-2018 Rafael da Silva Rocha.
    https://github.com/rochars/riff-chunks

    NPM version Docs
    Codecov Unix Build Windows Build Scrutinizer

    +

    About

    Read and write the chunks of RIFF files.

    Install

    npm install riff-chunks

    Use

    const riffChunks = require("riff-chunks");
     const fs = require("fs");
     
    @@ -104,7 +105,7 @@ 

    riffChunks.write()

    
     
     
    - Documentation generated by JSDoc 3.5.5 on Thu Apr 26 2018 10:35:18 GMT-0300 (Hora oficial do Brasil) using the docdash theme. + Documentation generated by JSDoc 3.5.5 on Thu May 03 2018 23:19:51 GMT-0300 (Hora oficial do Brasil) using the docdash theme.
    diff --git a/docs/index.js.html b/docs/index.js.html index c3ade32..311ca6f 100644 --- a/docs/index.js.html +++ b/docs/index.js.html @@ -37,10 +37,10 @@

    index.js

    -
    /*!
    +            
    /*
      * riff-chunks
      * Read and write the chunks of RIFF and RIFX files.
    - * Copyright (c) 2017 Rafael da Silva Rocha.
    + * Copyright (c) 2017-2018 Rafael da Silva Rocha.
      * https://github.com/rochars/riff-chunks
      *
      */
    @@ -48,11 +48,8 @@ 

    index.js

    /** @private */ const byteData = require("byte-data"); /** @private */ -const chr = byteData.chr; -/** @private */ let uInt32 = byteData.uInt32; - /** * Write the bytes of a RIFF/RIFX file. * @param {Object} chunks A structure like the return of riffChunks.read(). @@ -61,11 +58,11 @@

    index.js

    * when chunkId is "LIST". */ function write(chunks) { - uInt32.be = chunks["chunkId"] === "RIFX"; + uInt32["be"] = chunks["chunkId"] === "RIFX"; let bytes = - byteData.packArray(chunks["chunkId"], chr).concat( + byteData.packArray(chunks["chunkId"], byteData.chr).concat( byteData.pack(chunks["chunkSize"], uInt32), - byteData.packArray(chunks["format"], chr), + byteData.packArray(chunks["format"], byteData.chr), writeSubChunks_(chunks["subChunks"]) ); if (chunks["chunkId"] === "RIFF" || chunks["chunkId"] === "RIFX" ) { @@ -82,11 +79,11 @@

    index.js

    function read(buffer) { buffer = [].slice.call(buffer); let chunkId = getChunkId_(buffer, 0); - uInt32.be = chunkId === "RIFX"; + uInt32["be"] = chunkId === "RIFX"; return { "chunkId": chunkId, "chunkSize": getChunkSize_(buffer, 0), - "format": byteData.unpackArray(buffer.slice(8, 12), chr), + "format": byteData.unpackArray(buffer.slice(8, 12), byteData.chr), "subChunks": getSubChunks_(buffer) }; } @@ -105,7 +102,7 @@

    index.js

    subChunks = subChunks.concat(write(chunks[i])); } else { subChunks = subChunks.concat( - byteData.packArray(chunks[i]["chunkId"], chr), + byteData.packArray(chunks[i]["chunkId"], byteData.chr), byteData.pack(chunks[i]["chunkSize"], uInt32), chunks[i]["chunkData"] ); @@ -144,7 +141,7 @@

    index.js

    "chunkSize": getChunkSize_(buffer, index) }; if (chunk["chunkId"] === "LIST") { - chunk["format"] = byteData.unpackArray(buffer.slice(8, 12), chr); + chunk["format"] = byteData.unpackArray(buffer.slice(8, 12), byteData.chr); chunk["subChunks"] = getSubChunks_( buffer.slice(index, index + chunk["chunkSize"])); } else { @@ -162,7 +159,7 @@

    index.js

    * @private */ function getChunkId_(buffer, index) { - return byteData.unpackArray(buffer.slice(index, index + 4), chr); + return byteData.unpackArray(buffer.slice(index, index + 4), byteData.chr); } /** @@ -190,7 +187,7 @@

    index.js


    - Documentation generated by JSDoc 3.5.5 on Thu Apr 26 2018 10:35:18 GMT-0300 (Hora oficial do Brasil) using the docdash theme. + Documentation generated by JSDoc 3.5.5 on Thu May 03 2018 23:19:51 GMT-0300 (Hora oficial do Brasil) using the docdash theme.
    diff --git a/docs/styles/jsdoc-default.css b/docs/styles/jsdoc-default.css deleted file mode 100644 index 9207bc8..0000000 --- a/docs/styles/jsdoc-default.css +++ /dev/null @@ -1,358 +0,0 @@ -@font-face { - font-family: 'Open Sans'; - font-weight: normal; - font-style: normal; - src: url('../fonts/OpenSans-Regular-webfont.eot'); - src: - local('Open Sans'), - local('OpenSans'), - url('../fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'), - url('../fonts/OpenSans-Regular-webfont.woff') format('woff'), - url('../fonts/OpenSans-Regular-webfont.svg#open_sansregular') format('svg'); -} - -@font-face { - font-family: 'Open Sans Light'; - font-weight: normal; - font-style: normal; - src: url('../fonts/OpenSans-Light-webfont.eot'); - src: - local('Open Sans Light'), - local('OpenSans Light'), - url('../fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'), - url('../fonts/OpenSans-Light-webfont.woff') format('woff'), - url('../fonts/OpenSans-Light-webfont.svg#open_sanslight') format('svg'); -} - -html -{ - overflow: auto; - background-color: #fff; - font-size: 14px; -} - -body -{ - font-family: 'Open Sans', sans-serif; - line-height: 1.5; - color: #4d4e53; - background-color: white; -} - -a, a:visited, a:active { - color: #0095dd; - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -header -{ - display: block; - padding: 0px 4px; -} - -tt, code, kbd, samp { - font-family: Consolas, Monaco, 'Andale Mono', monospace; -} - -.class-description { - font-size: 130%; - line-height: 140%; - margin-bottom: 1em; - margin-top: 1em; -} - -.class-description:empty { - margin: 0; -} - -#main { - float: left; - width: 70%; -} - -article dl { - margin-bottom: 40px; -} - -article img { - max-width: 100%; -} - -section -{ - display: block; - background-color: #fff; - padding: 12px 24px; - border-bottom: 1px solid #ccc; - margin-right: 30px; -} - -.variation { - display: none; -} - -.signature-attributes { - font-size: 60%; - color: #aaa; - font-style: italic; - font-weight: lighter; -} - -nav -{ - display: block; - float: right; - margin-top: 28px; - width: 30%; - box-sizing: border-box; - border-left: 1px solid #ccc; - padding-left: 16px; -} - -nav ul { - font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif; - font-size: 100%; - line-height: 17px; - padding: 0; - margin: 0; - list-style-type: none; -} - -nav ul a, nav ul a:visited, nav ul a:active { - font-family: Consolas, Monaco, 'Andale Mono', monospace; - line-height: 18px; - color: #4D4E53; -} - -nav h3 { - margin-top: 12px; -} - -nav li { - margin-top: 6px; -} - -footer { - display: block; - padding: 6px; - margin-top: 12px; - font-style: italic; - font-size: 90%; -} - -h1, h2, h3, h4 { - font-weight: 200; - margin: 0; -} - -h1 -{ - font-family: 'Open Sans Light', sans-serif; - font-size: 48px; - letter-spacing: -2px; - margin: 12px 24px 20px; -} - -h2, h3.subsection-title -{ - font-size: 30px; - font-weight: 700; - letter-spacing: -1px; - margin-bottom: 12px; -} - -h3 -{ - font-size: 24px; - letter-spacing: -0.5px; - margin-bottom: 12px; -} - -h4 -{ - font-size: 18px; - letter-spacing: -0.33px; - margin-bottom: 12px; - color: #4d4e53; -} - -h5, .container-overview .subsection-title -{ - font-size: 120%; - font-weight: bold; - letter-spacing: -0.01em; - margin: 8px 0 3px 0; -} - -h6 -{ - font-size: 100%; - letter-spacing: -0.01em; - margin: 6px 0 3px 0; - font-style: italic; -} - -table -{ - border-spacing: 0; - border: 0; - border-collapse: collapse; -} - -td, th -{ - border: 1px solid #ddd; - margin: 0px; - text-align: left; - vertical-align: top; - padding: 4px 6px; - display: table-cell; -} - -thead tr -{ - background-color: #ddd; - font-weight: bold; -} - -th { border-right: 1px solid #aaa; } -tr > th:last-child { border-right: 1px solid #ddd; } - -.ancestors, .attribs { color: #999; } -.ancestors a, .attribs a -{ - color: #999 !important; - text-decoration: none; -} - -.clear -{ - clear: both; -} - -.important -{ - font-weight: bold; - color: #950B02; -} - -.yes-def { - text-indent: -1000px; -} - -.type-signature { - color: #aaa; -} - -.name, .signature { - font-family: Consolas, Monaco, 'Andale Mono', monospace; -} - -.details { margin-top: 14px; border-left: 2px solid #DDD; } -.details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; } -.details dd { margin-left: 70px; } -.details ul { margin: 0; } -.details ul { list-style-type: none; } -.details li { margin-left: 30px; padding-top: 6px; } -.details pre.prettyprint { margin: 0 } -.details .object-value { padding-top: 0; } - -.description { - margin-bottom: 1em; - margin-top: 1em; -} - -.code-caption -{ - font-style: italic; - font-size: 107%; - margin: 0; -} - -.prettyprint -{ - border: 1px solid #ddd; - width: 80%; - overflow: auto; -} - -.prettyprint.source { - width: inherit; -} - -.prettyprint code -{ - font-size: 100%; - line-height: 18px; - display: block; - padding: 4px 12px; - margin: 0; - background-color: #fff; - color: #4D4E53; -} - -.prettyprint code span.line -{ - display: inline-block; -} - -.prettyprint.linenums -{ - padding-left: 70px; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} - -.prettyprint.linenums ol -{ - padding-left: 0; -} - -.prettyprint.linenums li -{ - border-left: 3px #ddd solid; -} - -.prettyprint.linenums li.selected, -.prettyprint.linenums li.selected * -{ - background-color: lightyellow; -} - -.prettyprint.linenums li * -{ - -webkit-user-select: text; - -moz-user-select: text; - -ms-user-select: text; - user-select: text; -} - -.params .name, .props .name, .name code { - color: #4D4E53; - font-family: Consolas, Monaco, 'Andale Mono', monospace; - font-size: 100%; -} - -.params td.description > p:first-child, -.props td.description > p:first-child -{ - margin-top: 0; - padding-top: 0; -} - -.params td.description > p:last-child, -.props td.description > p:last-child -{ - margin-bottom: 0; - padding-bottom: 0; -} - -.disabled { - color: #454545; -} diff --git a/docs/styles/prettify-jsdoc.css b/docs/styles/prettify-jsdoc.css deleted file mode 100644 index 5a2526e..0000000 --- a/docs/styles/prettify-jsdoc.css +++ /dev/null @@ -1,111 +0,0 @@ -/* JSDoc prettify.js theme */ - -/* plain text */ -.pln { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* string content */ -.str { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a keyword */ -.kwd { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a comment */ -.com { - font-weight: normal; - font-style: italic; -} - -/* a type name */ -.typ { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* a literal value */ -.lit { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* punctuation */ -.pun { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* lisp open bracket */ -.opn { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* lisp close bracket */ -.clo { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a markup tag name */ -.tag { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a markup attribute name */ -.atn { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a markup attribute value */ -.atv { - color: #006400; - font-weight: normal; - font-style: normal; -} - -/* a declaration */ -.dec { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* a variable name */ -.var { - color: #000000; - font-weight: normal; - font-style: normal; -} - -/* a function name */ -.fun { - color: #000000; - font-weight: bold; - font-style: normal; -} - -/* Specify class=linenums on a pre to get line numbering */ -ol.linenums { - margin-top: 0; - margin-bottom: 0; -} diff --git a/docs/styles/prettify-tomorrow.css b/docs/styles/prettify-tomorrow.css deleted file mode 100644 index b6f92a7..0000000 --- a/docs/styles/prettify-tomorrow.css +++ /dev/null @@ -1,132 +0,0 @@ -/* Tomorrow Theme */ -/* Original theme - https://github.com/chriskempson/tomorrow-theme */ -/* Pretty printing styles. Used with prettify.js. */ -/* SPAN elements with the classes below are added by prettyprint. */ -/* plain text */ -.pln { - color: #4d4d4c; } - -@media screen { - /* string content */ - .str { - color: #718c00; } - - /* a keyword */ - .kwd { - color: #8959a8; } - - /* a comment */ - .com { - color: #8e908c; } - - /* a type name */ - .typ { - color: #4271ae; } - - /* a literal value */ - .lit { - color: #f5871f; } - - /* punctuation */ - .pun { - color: #4d4d4c; } - - /* lisp open bracket */ - .opn { - color: #4d4d4c; } - - /* lisp close bracket */ - .clo { - color: #4d4d4c; } - - /* a markup tag name */ - .tag { - color: #c82829; } - - /* a markup attribute name */ - .atn { - color: #f5871f; } - - /* a markup attribute value */ - .atv { - color: #3e999f; } - - /* a declaration */ - .dec { - color: #f5871f; } - - /* a variable name */ - .var { - color: #c82829; } - - /* a function name */ - .fun { - color: #4271ae; } } -/* Use higher contrast and text-weight for printable form. */ -@media print, projection { - .str { - color: #060; } - - .kwd { - color: #006; - font-weight: bold; } - - .com { - color: #600; - font-style: italic; } - - .typ { - color: #404; - font-weight: bold; } - - .lit { - color: #044; } - - .pun, .opn, .clo { - color: #440; } - - .tag { - color: #006; - font-weight: bold; } - - .atn { - color: #404; } - - .atv { - color: #060; } } -/* Style */ -/* -pre.prettyprint { - background: white; - font-family: Consolas, Monaco, 'Andale Mono', monospace; - font-size: 12px; - line-height: 1.5; - border: 1px solid #ccc; - padding: 10px; } -*/ - -/* Specify class=linenums on a pre to get line numbering */ -ol.linenums { - margin-top: 0; - margin-bottom: 0; } - -/* IE indents via margin-left */ -li.L0, -li.L1, -li.L2, -li.L3, -li.L4, -li.L5, -li.L6, -li.L7, -li.L8, -li.L9 { - /* */ } - -/* Alternate shading for lines */ -li.L1, -li.L3, -li.L5, -li.L7, -li.L9 { - /* */ } diff --git a/index.js b/index.js index 1c97ae7..4686056 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ -/*! +/* * riff-chunks * Read and write the chunks of RIFF and RIFX files. - * Copyright (c) 2017 Rafael da Silva Rocha. + * Copyright (c) 2017-2018 Rafael da Silva Rocha. * https://github.com/rochars/riff-chunks * */ @@ -9,11 +9,8 @@ /** @private */ const byteData = require("byte-data"); /** @private */ -const chr = byteData.chr; -/** @private */ let uInt32 = byteData.uInt32; - /** * Write the bytes of a RIFF/RIFX file. * @param {Object} chunks A structure like the return of riffChunks.read(). @@ -22,11 +19,11 @@ let uInt32 = byteData.uInt32; * when chunkId is "LIST". */ function write(chunks) { - uInt32.be = chunks["chunkId"] === "RIFX"; + uInt32["be"] = chunks["chunkId"] === "RIFX"; let bytes = - byteData.packArray(chunks["chunkId"], chr).concat( + byteData.packArray(chunks["chunkId"], byteData.chr).concat( byteData.pack(chunks["chunkSize"], uInt32), - byteData.packArray(chunks["format"], chr), + byteData.packArray(chunks["format"], byteData.chr), writeSubChunks_(chunks["subChunks"]) ); if (chunks["chunkId"] === "RIFF" || chunks["chunkId"] === "RIFX" ) { @@ -43,11 +40,11 @@ function write(chunks) { function read(buffer) { buffer = [].slice.call(buffer); let chunkId = getChunkId_(buffer, 0); - uInt32.be = chunkId === "RIFX"; + uInt32["be"] = chunkId === "RIFX"; return { "chunkId": chunkId, "chunkSize": getChunkSize_(buffer, 0), - "format": byteData.unpackArray(buffer.slice(8, 12), chr), + "format": byteData.unpackArray(buffer.slice(8, 12), byteData.chr), "subChunks": getSubChunks_(buffer) }; } @@ -66,7 +63,7 @@ function writeSubChunks_(chunks) { subChunks = subChunks.concat(write(chunks[i])); } else { subChunks = subChunks.concat( - byteData.packArray(chunks[i]["chunkId"], chr), + byteData.packArray(chunks[i]["chunkId"], byteData.chr), byteData.pack(chunks[i]["chunkSize"], uInt32), chunks[i]["chunkData"] ); @@ -105,7 +102,7 @@ function getSubChunk_(buffer, index) { "chunkSize": getChunkSize_(buffer, index) }; if (chunk["chunkId"] === "LIST") { - chunk["format"] = byteData.unpackArray(buffer.slice(8, 12), chr); + chunk["format"] = byteData.unpackArray(buffer.slice(8, 12), byteData.chr); chunk["subChunks"] = getSubChunks_( buffer.slice(index, index + chunk["chunkSize"])); } else { @@ -123,7 +120,7 @@ function getSubChunk_(buffer, index) { * @private */ function getChunkId_(buffer, index) { - return byteData.unpackArray(buffer.slice(index, index + 4), chr); + return byteData.unpackArray(buffer.slice(index, index + 4), byteData.chr); } /** diff --git a/package.json b/package.json index 348e68c..03b9849 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "riff-chunks", - "version": "4.0.0", + "version": "4.0.1", "description": "Read and write the chunks of RIFF and RIFX files.", "homepage": "https://github.com/rochars/riff-chunks", "author": "Rafael da Silva Rocha ", @@ -14,7 +14,8 @@ "chunk", "parser", "read", - "write" + "write", + "file" ], "repository": { "type": "git", @@ -25,10 +26,9 @@ "test": "nyc ./node_modules/mocha/bin/_mocha test --src --recursive", "test-dist": "nyc ./node_modules/mocha/bin/_mocha test --dist --recursive", "coverage": "nyc report --reporter=lcov > coverage.lcov && codecov", - "compile": "google-closure-compiler-js dist/riff-chunks.js > dist/riff-chunks-min.js --compilationLevel=ADVANCED", "doc": "./node_modules/.bin/jsdoc index.js -d docs -r README.md -t node_modules/docdash", - "pack": "webpack && npm run compile && npm run doc", - "build": "npm run lint && npm test && npm run pack && npm run test-dist" + "pack": "webpack && npm run test-dist", + "build": "npm run lint && npm run pack && npm test && npm run doc" }, "devDependencies": { "browser-env": "^3.2.4", @@ -45,6 +45,6 @@ }, "main": "index.js", "dependencies": { - "byte-data": "^5.0.1" + "byte-data": "^7.0.0" } } diff --git a/webpack.config.js b/webpack.config.js index 08580fe..dcbf77d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,33 +1,22 @@ -/*! - * Copyright (c) 2017 Rafael da Silva Rocha. +/** + * Copyright (c) 2017-2018 Rafael da Silva Rocha. * https://github.com/rochars/riff-chunks * */ - +const ClosureCompiler = require('google-closure-compiler-js').webpack; module.exports = { - entry: './index.js', + entry: './compile.js', output: { - filename: './dist/riff-chunks.js' + filename: './dist/riff-chunks-min.js' }, - module: { - loaders: [ - { - test: /index\.js$/, - loader: 'string-replace-loader', - query: { - multiple: [ - { - search: 'module.exports.read', - replace: "window['riffChunks'] = window['riffChunks'] || {};" + - "window['riffChunks']['read']" - }, - { - search: 'module.exports.write', - replace: "window['riffChunks']['write']" - } - ] - } + plugins: [ + new ClosureCompiler({ + options: { + languageIn: 'ECMASCRIPT6', + languageOut: 'ECMASCRIPT5', + compilationLevel: 'ADVANCED', + warningLevel: 'VERBOSE' } - ] - } + }) + ] }; \ No newline at end of file