first commit
This commit is contained in:
2
build/node_modules/buffer-alloc-unsafe/.npmignore
generated
vendored
Normal file
2
build/node_modules/buffer-alloc-unsafe/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/node_modules/
|
||||
/npm-debug.log
|
||||
17
build/node_modules/buffer-alloc-unsafe/index.js
generated
vendored
Normal file
17
build/node_modules/buffer-alloc-unsafe/index.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
function allocUnsafe (size) {
|
||||
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.allocUnsafe) {
|
||||
return Buffer.allocUnsafe(size)
|
||||
} else {
|
||||
return new Buffer(size)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = allocUnsafe
|
||||
53
build/node_modules/buffer-alloc-unsafe/package.json
generated
vendored
Normal file
53
build/node_modules/buffer-alloc-unsafe/package.json
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"_from": "buffer-alloc-unsafe@^0.1.0",
|
||||
"_id": "buffer-alloc-unsafe@0.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-/+H2dVHdBVc33iUzN7/oU9+rGmo=",
|
||||
"_location": "/buffer-alloc-unsafe",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "buffer-alloc-unsafe@^0.1.0",
|
||||
"name": "buffer-alloc-unsafe",
|
||||
"escapedName": "buffer-alloc-unsafe",
|
||||
"rawSpec": "^0.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/buffer-alloc"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-0.1.1.tgz",
|
||||
"_shasum": "ffe1f67551dd055737de253337bfe853dfab1a6a",
|
||||
"_spec": "buffer-alloc-unsafe@^0.1.0",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build/node_modules/buffer-alloc",
|
||||
"bugs": {
|
||||
"url": "https://github.com/LinusU/buffer-alloc-unsafe/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "A ponyfill for `Buffer.allocUnsafe`.",
|
||||
"devDependencies": {
|
||||
"standard": "^7.1.2"
|
||||
},
|
||||
"homepage": "https://github.com/LinusU/buffer-alloc-unsafe#readme",
|
||||
"keywords": [
|
||||
"allocUnsafe",
|
||||
"allocate",
|
||||
"buffer allocUnsafe",
|
||||
"buffer unsafe allocate",
|
||||
"buffer",
|
||||
"unsafe allocate"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "buffer-alloc-unsafe",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/LinusU/buffer-alloc-unsafe.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && node test"
|
||||
},
|
||||
"version": "0.1.1"
|
||||
}
|
||||
46
build/node_modules/buffer-alloc-unsafe/readme.md
generated
vendored
Normal file
46
build/node_modules/buffer-alloc-unsafe/readme.md
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
# Buffer Alloc Unsafe
|
||||
|
||||
A ponyfill for `Buffer.allocUnsafe`.
|
||||
|
||||
Works as Node.js: `v7.0.0` <br>
|
||||
Works on Node.js: `v0.10.0`
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install --save buffer-alloc-unsafe
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const allocUnsafe = require('buffer-alloc-unsafe')
|
||||
|
||||
console.log(allocUnsafe(10))
|
||||
//=> <Buffer 78 0c 80 03 01 00 00 00 05 00>
|
||||
|
||||
console.log(allocUnsafe(10))
|
||||
//=> <Buffer 58 ed bf 5f ff 7f 00 00 01 00>
|
||||
|
||||
console.log(allocUnsafe(10))
|
||||
//=> <Buffer 50 0c 80 03 01 00 00 00 0a 00>
|
||||
|
||||
allocUnsafe(-10)
|
||||
//=> RangeError: "size" argument must not be negative
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### allocUnsafe(size)
|
||||
|
||||
- `size` <Integer> The desired length of the new `Buffer`
|
||||
|
||||
Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must be
|
||||
less than or equal to the value of `buffer.kMaxLength` and greater than or equal
|
||||
to zero. Otherwise, a `RangeError` is thrown.
|
||||
|
||||
## See also
|
||||
|
||||
- [buffer-alloc](https://github.com/LinusU/buffer-alloc) A ponyfill for `Buffer.alloc`
|
||||
- [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`
|
||||
14
build/node_modules/buffer-alloc-unsafe/test.js
generated
vendored
Normal file
14
build/node_modules/buffer-alloc-unsafe/test.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
var allocUnsafe = require('./')
|
||||
var assert = require('assert')
|
||||
|
||||
var b1 = allocUnsafe(4)
|
||||
assert.equal(b1.length, 4)
|
||||
assert.ok(Buffer.isBuffer(b1))
|
||||
|
||||
var b2 = allocUnsafe(6)
|
||||
assert.equal(b2.length, 6)
|
||||
assert.ok(Buffer.isBuffer(b2))
|
||||
|
||||
var b3 = allocUnsafe(10)
|
||||
assert.equal(b3.length, 10)
|
||||
assert.ok(Buffer.isBuffer(b3))
|
||||
Reference in New Issue
Block a user