Simulator first commit
This commit is contained in:
32
node_modules/buffer-alloc/index.js
generated
vendored
Normal file
32
node_modules/buffer-alloc/index.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
var bufferFill = require('buffer-fill')
|
||||
var allocUnsafe = require('buffer-alloc-unsafe')
|
||||
|
||||
module.exports = function alloc (size, fill, encoding) {
|
||||
if (typeof size !== 'number') {
|
||||
throw new TypeError('"size" argument must be a number')
|
||||
}
|
||||
|
||||
if (size < 0) {
|
||||
throw new RangeError('"size" argument must not be negative')
|
||||
}
|
||||
|
||||
if (Buffer.alloc) {
|
||||
return Buffer.alloc(size, fill, encoding)
|
||||
}
|
||||
|
||||
var buffer = allocUnsafe(size)
|
||||
|
||||
if (size === 0) {
|
||||
return buffer
|
||||
}
|
||||
|
||||
if (fill === undefined) {
|
||||
return bufferFill(buffer, 0)
|
||||
}
|
||||
|
||||
if (typeof encoding !== 'string') {
|
||||
encoding = undefined
|
||||
}
|
||||
|
||||
return bufferFill(buffer, fill, encoding)
|
||||
}
|
59
node_modules/buffer-alloc/package.json
generated
vendored
Normal file
59
node_modules/buffer-alloc/package.json
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
{
|
||||
"_from": "buffer-alloc@^1.1.0",
|
||||
"_id": "buffer-alloc@1.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==",
|
||||
"_location": "/buffer-alloc",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "buffer-alloc@^1.1.0",
|
||||
"name": "buffer-alloc",
|
||||
"escapedName": "buffer-alloc",
|
||||
"rawSpec": "^1.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/speaker"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz",
|
||||
"_shasum": "890dd90d923a873e08e10e5fd51a57e5b7cce0ec",
|
||||
"_spec": "buffer-alloc@^1.1.0",
|
||||
"_where": "/home/sergiu/linx-audio-simulator/node_modules/speaker",
|
||||
"bugs": {
|
||||
"url": "https://github.com/LinusU/buffer-alloc/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"buffer-alloc-unsafe": "^1.1.0",
|
||||
"buffer-fill": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "A [ponyfill](https://ponyfill.com) for `Buffer.alloc`.",
|
||||
"devDependencies": {
|
||||
"standard": "^7.1.2"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/LinusU/buffer-alloc#readme",
|
||||
"keywords": [
|
||||
"alloc",
|
||||
"allocate",
|
||||
"buffer alloc",
|
||||
"buffer allocate",
|
||||
"buffer"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "buffer-alloc",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/LinusU/buffer-alloc.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && node test"
|
||||
},
|
||||
"version": "1.2.0"
|
||||
}
|
43
node_modules/buffer-alloc/readme.md
generated
vendored
Normal file
43
node_modules/buffer-alloc/readme.md
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
# Buffer Alloc
|
||||
|
||||
A [ponyfill](https://ponyfill.com) for `Buffer.alloc`.
|
||||
|
||||
Works as Node.js: `v7.0.0` <br>
|
||||
Works on Node.js: `v0.10.0`
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install --save buffer-alloc
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const alloc = require('buffer-alloc')
|
||||
|
||||
console.log(alloc(4))
|
||||
//=> <Buffer 00 00 00 00>
|
||||
|
||||
console.log(alloc(6, 0x41))
|
||||
//=> <Buffer 41 41 41 41 41 41>
|
||||
|
||||
console.log(alloc(10, 'linus', 'utf8'))
|
||||
//=> <Buffer 6c 69 6e 75 73 6c 69 6e 75 73>
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### alloc(size[, fill[, encoding]])
|
||||
|
||||
- `size` <Integer> The desired length of the new `Buffer`
|
||||
- `fill` <String> | <Buffer> | <Integer> A value to pre-fill the new `Buffer` with. **Default:** `0`
|
||||
- `encoding` <String> If `fill` is a string, this is its encoding. **Default:** `'utf8'`
|
||||
|
||||
Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the `Buffer` will be zero-filled.
|
||||
|
||||
## See also
|
||||
|
||||
- [buffer-alloc-unsafe](https://github.com/LinusU/buffer-alloc-unsafe) A ponyfill for `Buffer.allocUnsafe`
|
||||
- [buffer-fill](https://github.com/LinusU/buffer-fill) A ponyfill for `Buffer.fill`
|
||||
- [buffer-from](https://github.com/LinusU/buffer-from) A ponyfill for `Buffer.from`
|
Reference in New Issue
Block a user