Template Upload
This commit is contained in:
108
node_modules/buffer-shims/index.js
generated
vendored
Normal file
108
node_modules/buffer-shims/index.js
generated
vendored
Normal file
@ -0,0 +1,108 @@
|
||||
'use strict';
|
||||
|
||||
var buffer = require('buffer');
|
||||
var Buffer = buffer.Buffer;
|
||||
var SlowBuffer = buffer.SlowBuffer;
|
||||
var MAX_LEN = buffer.kMaxLength || 2147483647;
|
||||
exports.alloc = function alloc(size, fill, encoding) {
|
||||
if (typeof Buffer.alloc === 'function') {
|
||||
return Buffer.alloc(size, fill, encoding);
|
||||
}
|
||||
if (typeof encoding === 'number') {
|
||||
throw new TypeError('encoding must not be number');
|
||||
}
|
||||
if (typeof size !== 'number') {
|
||||
throw new TypeError('size must be a number');
|
||||
}
|
||||
if (size > MAX_LEN) {
|
||||
throw new RangeError('size is too large');
|
||||
}
|
||||
var enc = encoding;
|
||||
var _fill = fill;
|
||||
if (_fill === undefined) {
|
||||
enc = undefined;
|
||||
_fill = 0;
|
||||
}
|
||||
var buf = new Buffer(size);
|
||||
if (typeof _fill === 'string') {
|
||||
var fillBuf = new Buffer(_fill, enc);
|
||||
var flen = fillBuf.length;
|
||||
var i = -1;
|
||||
while (++i < size) {
|
||||
buf[i] = fillBuf[i % flen];
|
||||
}
|
||||
} else {
|
||||
buf.fill(_fill);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
exports.allocUnsafe = function allocUnsafe(size) {
|
||||
if (typeof Buffer.allocUnsafe === 'function') {
|
||||
return Buffer.allocUnsafe(size);
|
||||
}
|
||||
if (typeof size !== 'number') {
|
||||
throw new TypeError('size must be a number');
|
||||
}
|
||||
if (size > MAX_LEN) {
|
||||
throw new RangeError('size is too large');
|
||||
}
|
||||
return new Buffer(size);
|
||||
}
|
||||
exports.from = function from(value, encodingOrOffset, length) {
|
||||
if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) {
|
||||
return Buffer.from(value, encodingOrOffset, length);
|
||||
}
|
||||
if (typeof value === 'number') {
|
||||
throw new TypeError('"value" argument must not be a number');
|
||||
}
|
||||
if (typeof value === 'string') {
|
||||
return new Buffer(value, encodingOrOffset);
|
||||
}
|
||||
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
|
||||
var offset = encodingOrOffset;
|
||||
if (arguments.length === 1) {
|
||||
return new Buffer(value);
|
||||
}
|
||||
if (typeof offset === 'undefined') {
|
||||
offset = 0;
|
||||
}
|
||||
var len = length;
|
||||
if (typeof len === 'undefined') {
|
||||
len = value.byteLength - offset;
|
||||
}
|
||||
if (offset >= value.byteLength) {
|
||||
throw new RangeError('\'offset\' is out of bounds');
|
||||
}
|
||||
if (len > value.byteLength - offset) {
|
||||
throw new RangeError('\'length\' is out of bounds');
|
||||
}
|
||||
return new Buffer(value.slice(offset, offset + len));
|
||||
}
|
||||
if (Buffer.isBuffer(value)) {
|
||||
var out = new Buffer(value.length);
|
||||
value.copy(out, 0, 0, value.length);
|
||||
return out;
|
||||
}
|
||||
if (value) {
|
||||
if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) {
|
||||
return new Buffer(value);
|
||||
}
|
||||
if (value.type === 'Buffer' && Array.isArray(value.data)) {
|
||||
return new Buffer(value.data);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.');
|
||||
}
|
||||
exports.allocUnsafeSlow = function allocUnsafeSlow(size) {
|
||||
if (typeof Buffer.allocUnsafeSlow === 'function') {
|
||||
return Buffer.allocUnsafeSlow(size);
|
||||
}
|
||||
if (typeof size !== 'number') {
|
||||
throw new TypeError('size must be a number');
|
||||
}
|
||||
if (size >= MAX_LEN) {
|
||||
throw new RangeError('size is too large');
|
||||
}
|
||||
return new SlowBuffer(size);
|
||||
}
|
19
node_modules/buffer-shims/license.md
generated
vendored
Normal file
19
node_modules/buffer-shims/license.md
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
# Copyright (c) 2016 Calvin Metcalf
|
||||
|
||||
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.**
|
76
node_modules/buffer-shims/package.json
generated
vendored
Normal file
76
node_modules/buffer-shims/package.json
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"buffer-shims@~1.0.0",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\readable-stream"
|
||||
]
|
||||
],
|
||||
"_from": "buffer-shims@>=1.0.0-0 <1.1.0-0",
|
||||
"_id": "buffer-shims@1.0.0",
|
||||
"_inCache": true,
|
||||
"_location": "/buffer-shims",
|
||||
"_nodeVersion": "5.11.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/buffer-shims-1.0.0.tgz_1462560889323_0.8640750856138766"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "calvin.metcalf@gmail.com",
|
||||
"name": "cwmma"
|
||||
},
|
||||
"_npmVersion": "3.8.6",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "buffer-shims",
|
||||
"raw": "buffer-shims@~1.0.0",
|
||||
"rawSpec": "~1.0.0",
|
||||
"scope": null,
|
||||
"spec": ">=1.0.0-0 <1.1.0-0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/readable-stream",
|
||||
"/string_decoder"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz",
|
||||
"_shasum": "9978ce317388c649ad8793028c3477ef044a8b51",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "buffer-shims@~1.0.0",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\readable-stream",
|
||||
"bugs": {
|
||||
"url": "https://github.com/calvinmetcalf/buffer-shims/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "some shims for node buffers",
|
||||
"devDependencies": {
|
||||
"tape": "^4.5.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "9978ce317388c649ad8793028c3477ef044a8b51",
|
||||
"tarball": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "ea89b3857ab5b8203957922a84e9a48cf4c47e0a",
|
||||
"installable": true,
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "cwmma",
|
||||
"email": "calvin.metcalf@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "buffer-shims",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:calvinmetcalf/buffer-shims.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
21
node_modules/buffer-shims/readme.md
generated
vendored
Normal file
21
node_modules/buffer-shims/readme.md
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
buffer-shims
|
||||
===
|
||||
|
||||
functions to make sure the new buffer methods work in older browsers.
|
||||
|
||||
```js
|
||||
var bufferShim = require('buffer-shims');
|
||||
bufferShim.from('foo');
|
||||
bufferShim.alloc(9, 'cafeface', 'hex');
|
||||
bufferShim.allocUnsafe(15);
|
||||
bufferShim.allocUnsafeSlow(21);
|
||||
```
|
||||
|
||||
should just use the original in newer nodes and on older nodes uses fallbacks.
|
||||
|
||||
Known Issues
|
||||
===
|
||||
- this does not patch the buffer object, only the constructor stuff
|
||||
- it's actually a polyfill
|
||||
|
||||

|
Reference in New Issue
Block a user