Simulator first commit
This commit is contained in:
4
node_modules/to-arraybuffer/.npmignore
generated
vendored
Normal file
4
node_modules/to-arraybuffer/.npmignore
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
npm-debug.log
|
||||
.zuulrc
|
3
node_modules/to-arraybuffer/.travis.yml
generated
vendored
Normal file
3
node_modules/to-arraybuffer/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "4.1"
|
16
node_modules/to-arraybuffer/.zuul.yml
generated
vendored
Normal file
16
node_modules/to-arraybuffer/.zuul.yml
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
ui: tape
|
||||
browsers:
|
||||
- name: chrome
|
||||
version: 39..latest
|
||||
- name: firefox
|
||||
version: 34..latest
|
||||
- name: safari
|
||||
version: 5..latest
|
||||
- name: ie
|
||||
version: 10..latest
|
||||
- name: opera
|
||||
version: 11..latest
|
||||
- name: iphone
|
||||
version: 5.1..latest
|
||||
- name: android
|
||||
version: 4.0..latest
|
24
node_modules/to-arraybuffer/LICENSE
generated
vendored
Normal file
24
node_modules/to-arraybuffer/LICENSE
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2016 John Hiesey
|
||||
|
||||
Permission is hereby granted, free of charge,
|
||||
to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify,
|
||||
merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom
|
||||
the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27
node_modules/to-arraybuffer/README.md
generated
vendored
Normal file
27
node_modules/to-arraybuffer/README.md
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
# to-arraybuffer [](https://travis-ci.org/jhiesey/to-arraybuffer)
|
||||
|
||||
[](https://saucelabs.com/u/to-arraybuffer)
|
||||
|
||||
Convert from a Buffer to an ArrayBuffer as fast as possible.
|
||||
|
||||
Note that in some cases the returned ArrayBuffer is backed by the same memory as the original
|
||||
Buffer (but in other cases it is a copy), so **modifying the ArrayBuffer is not recommended**.
|
||||
|
||||
This module is designed to work both in node.js and in all browsers with ArrayBuffer support
|
||||
when using [the Buffer implementation provided by Browserify](https://www.npmjs.com/package/buffer).
|
||||
|
||||
## Usage
|
||||
|
||||
``` js
|
||||
var toArrayBuffer = require('to-arraybuffer')
|
||||
|
||||
var buffer = new Buffer(100)
|
||||
// Fill the buffer with some data
|
||||
|
||||
var ab = toArrayBuffer(buffer)
|
||||
// `ab` now contains the same data as `buffer`
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
27
node_modules/to-arraybuffer/index.js
generated
vendored
Normal file
27
node_modules/to-arraybuffer/index.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
var Buffer = require('buffer').Buffer
|
||||
|
||||
module.exports = function (buf) {
|
||||
// If the buffer is backed by a Uint8Array, a faster version will work
|
||||
if (buf instanceof Uint8Array) {
|
||||
// If the buffer isn't a subarray, return the underlying ArrayBuffer
|
||||
if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
|
||||
return buf.buffer
|
||||
} else if (typeof buf.buffer.slice === 'function') {
|
||||
// Otherwise we need to get a proper copy
|
||||
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength)
|
||||
}
|
||||
}
|
||||
|
||||
if (Buffer.isBuffer(buf)) {
|
||||
// This is the slow version that will work with any Buffer
|
||||
// implementation (even in old browsers)
|
||||
var arrayCopy = new Uint8Array(buf.length)
|
||||
var len = buf.length
|
||||
for (var i = 0; i < len; i++) {
|
||||
arrayCopy[i] = buf[i]
|
||||
}
|
||||
return arrayCopy.buffer
|
||||
} else {
|
||||
throw new Error('Argument must be a Buffer')
|
||||
}
|
||||
}
|
61
node_modules/to-arraybuffer/package.json
generated
vendored
Normal file
61
node_modules/to-arraybuffer/package.json
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"_from": "to-arraybuffer@^1.0.1",
|
||||
"_id": "to-arraybuffer@1.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=",
|
||||
"_location": "/to-arraybuffer",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "to-arraybuffer@^1.0.1",
|
||||
"name": "to-arraybuffer",
|
||||
"escapedName": "to-arraybuffer",
|
||||
"rawSpec": "^1.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/mumble-client-codecs-node"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz",
|
||||
"_shasum": "7d229b1fcc637e466ca081180836a7aabff83f43",
|
||||
"_spec": "to-arraybuffer@^1.0.1",
|
||||
"_where": "/home/sergiu/linx-audio-simulator/node_modules/mumble-client-codecs-node",
|
||||
"author": {
|
||||
"name": "John Hiesey"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jhiesey/to-arraybuffer/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Get an ArrayBuffer from a Buffer as fast as possible",
|
||||
"devDependencies": {
|
||||
"tape": "^4.4.0",
|
||||
"zuul": "^3.9.0"
|
||||
},
|
||||
"homepage": "https://github.com/jhiesey/to-arraybuffer#readme",
|
||||
"keywords": [
|
||||
"buffer",
|
||||
"to",
|
||||
"arraybuffer",
|
||||
"fast",
|
||||
"read",
|
||||
"only"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "to-arraybuffer",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/jhiesey/to-arraybuffer.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "npm run test-node && ([ -n \"${TRAVIS_PULL_REQUEST}\" -a \"${TRAVIS_PULL_REQUEST}\" != 'false' ] || npm run test-browser)",
|
||||
"test-browser": "zuul --no-coverage -- test.js",
|
||||
"test-browser-local": "zuul --local 8080 --no-coverage -- test.js",
|
||||
"test-node": "tape test.js"
|
||||
},
|
||||
"version": "1.0.1"
|
||||
}
|
57
node_modules/to-arraybuffer/test.js
generated
vendored
Normal file
57
node_modules/to-arraybuffer/test.js
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
var Buffer = require('buffer').Buffer
|
||||
var test = require('tape')
|
||||
|
||||
var toArrayBuffer = require('.')
|
||||
|
||||
function elementsEqual (ab, buffer) {
|
||||
var view = new Uint8Array(ab)
|
||||
for (var i = 0; i < view.length; i++) {
|
||||
if (view[i] !== buffer[i]) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
test('Basic behavior', function (t) {
|
||||
var buf = new Buffer(10)
|
||||
for (var i = 0; i < 10; i++) {
|
||||
buf[i] = i
|
||||
}
|
||||
|
||||
var ab = toArrayBuffer(buf)
|
||||
|
||||
t.equals(ab.byteLength, 10, 'correct length')
|
||||
t.ok(elementsEqual(ab, buf), 'elements equal')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('Behavior when input is a subarray 1', function (t) {
|
||||
var origBuf = new Buffer(10)
|
||||
for (var i = 0; i < 10; i++) {
|
||||
origBuf[i] = i
|
||||
}
|
||||
var buf = origBuf.slice(1)
|
||||
|
||||
var ab = toArrayBuffer(buf)
|
||||
|
||||
t.equals(ab.byteLength, 9, 'correct length')
|
||||
t.ok(elementsEqual(ab, buf), 'elements equal')
|
||||
t.notOk(ab === buf.buffer, 'the underlying ArrayBuffer is not returned when incorrect')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('Behavior when input is a subarray 2', function (t) {
|
||||
var origBuf = new Buffer(10)
|
||||
for (var i = 0; i < 10; i++) {
|
||||
origBuf[i] = i
|
||||
}
|
||||
var buf = origBuf.slice(0, 9)
|
||||
|
||||
var ab = toArrayBuffer(buf)
|
||||
|
||||
t.equals(ab.byteLength, 9, 'correct length')
|
||||
t.ok(elementsEqual(ab, buf), 'elements equal')
|
||||
t.notOk(ab === buf.buffer, 'the underlying ArrayBuffer is not returned when incorrect')
|
||||
t.end()
|
||||
})
|
Reference in New Issue
Block a user