diff options
Diffstat (limited to 'node_modules/clone-buffer')
-rw-r--r-- | node_modules/clone-buffer/LICENSE | 21 | ||||
-rw-r--r-- | node_modules/clone-buffer/README.md | 47 | ||||
-rw-r--r-- | node_modules/clone-buffer/index.js | 28 | ||||
-rw-r--r-- | node_modules/clone-buffer/package.json | 117 |
4 files changed, 213 insertions, 0 deletions
diff --git a/node_modules/clone-buffer/LICENSE b/node_modules/clone-buffer/LICENSE new file mode 100644 index 000000000..fa16a8943 --- /dev/null +++ b/node_modules/clone-buffer/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Blaine Bublitz <blaine.bublitz@gmail.com>, Eric Schoffstall <yo@contra.io> and other contributors + +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. diff --git a/node_modules/clone-buffer/README.md b/node_modules/clone-buffer/README.md new file mode 100644 index 000000000..51c8a8d21 --- /dev/null +++ b/node_modules/clone-buffer/README.md @@ -0,0 +1,47 @@ +<p align="center"> + <a href="http://gulpjs.com"> + <img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png"> + </a> +</p> + +# clone-buffer + +[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] + +Easier Buffer cloning in node. + +## Example + +```js +var cloneBuffer = require('clone-buffer'); + +var buffer = new Buffer('test'); +var cloned = cloneBuffer(buffer); +// buffer !== cloned +``` + +## API + +### `cloneBuffer(buffer)` + +Takes a `Buffer` object and returns a clone. Throws if a non-`Buffer` is passed. + +## License + +MIT + +[downloads-image]: http://img.shields.io/npm/dm/clone-buffer.svg +[npm-url]: https://npmjs.org/package/clone-buffer +[npm-image]: http://img.shields.io/npm/v/clone-buffer.svg + +[travis-url]: https://travis-ci.org/gulpjs/clone-buffer +[travis-image]: http://img.shields.io/travis/gulpjs/clone-buffer.svg?label=travis-ci + +[appveyor-url]: https://ci.appveyor.com/project/gulpjs/clone-buffer +[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/clone-buffer.svg?label=appveyor + +[coveralls-url]: https://coveralls.io/r/gulpjs/clone-buffer +[coveralls-image]: http://img.shields.io/coveralls/gulpjs/clone-buffer/master.svg + +[gitter-url]: https://gitter.im/gulpjs/gulp +[gitter-image]: https://badges.gitter.im/gulpjs/gulp.png diff --git a/node_modules/clone-buffer/index.js b/node_modules/clone-buffer/index.js new file mode 100644 index 000000000..eb3837e67 --- /dev/null +++ b/node_modules/clone-buffer/index.js @@ -0,0 +1,28 @@ +'use strict'; + +var Buffer = require('buffer').Buffer; + +function hasFrom() { + // Node versions 5.x below 5.10 seem to have a `from` method + // However, it doesn't clone Buffers + // Luckily, it reports as `false` to hasOwnProperty + return (Buffer.hasOwnProperty('from') && typeof Buffer.from === 'function'); +} + +function cloneBuffer(buf) { + if (!Buffer.isBuffer(buf)) { + throw new Error('Can only clone Buffer.'); + } + + if (hasFrom()) { + return Buffer.from(buf); + } + + var copy = new Buffer(buf.length); + buf.copy(copy); + return copy; +} + +cloneBuffer.hasFrom = hasFrom; + +module.exports = cloneBuffer; diff --git a/node_modules/clone-buffer/package.json b/node_modules/clone-buffer/package.json new file mode 100644 index 000000000..77fa6a98d --- /dev/null +++ b/node_modules/clone-buffer/package.json @@ -0,0 +1,117 @@ +{ + "_args": [ + [ + { + "raw": "clone-buffer@^1.0.0", + "scope": null, + "escapedName": "clone-buffer", + "name": "clone-buffer", + "rawSpec": "^1.0.0", + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "/home/dold/repos/taler/wallet-webex/node_modules/vinyl" + ] + ], + "_from": "clone-buffer@>=1.0.0 <2.0.0", + "_id": "clone-buffer@1.0.0", + "_inCache": true, + "_location": "/clone-buffer", + "_nodeVersion": "0.10.41", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/clone-buffer-1.0.0.tgz_1474782560642_0.6453048929106444" + }, + "_npmUser": { + "name": "phated", + "email": "blaine.bublitz@gmail.com" + }, + "_npmVersion": "2.15.2", + "_phantomChildren": {}, + "_requested": { + "raw": "clone-buffer@^1.0.0", + "scope": null, + "escapedName": "clone-buffer", + "name": "clone-buffer", + "rawSpec": "^1.0.0", + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/vinyl" + ], + "_resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz", + "_shasum": "e3e25b207ac4e701af721e2cb5a16792cac3dc58", + "_shrinkwrap": null, + "_spec": "clone-buffer@^1.0.0", + "_where": "/home/dold/repos/taler/wallet-webex/node_modules/vinyl", + "author": { + "name": "Gulp Team", + "email": "team@gulpjs.com", + "url": "http://gulpjs.com/" + }, + "bugs": { + "url": "https://github.com/gulpjs/clone-buffer/issues" + }, + "contributors": [ + { + "name": "Blaine Bublitz", + "email": "blaine.bublitz@gmail.com" + } + ], + "dependencies": {}, + "description": "Easier Buffer cloning in node.", + "devDependencies": { + "eslint": "^1.7.3", + "eslint-config-gulp": "^2.0.0", + "expect": "^1.19.0", + "istanbul": "^0.4.3", + "istanbul-coveralls": "^1.0.3", + "jscs": "^2.3.5", + "jscs-preset-gulp": "^1.0.0", + "mocha": "^2.4.5" + }, + "directories": {}, + "dist": { + "shasum": "e3e25b207ac4e701af721e2cb5a16792cac3dc58", + "tarball": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz" + }, + "engines": { + "node": ">= 0.10" + }, + "files": [ + "LICENSE", + "index.js" + ], + "gitHead": "7dab09850f080e2d137c62c6a673344fa8458942", + "homepage": "https://github.com/gulpjs/clone-buffer#readme", + "keywords": [ + "buffer", + "clone", + "from", + "copy" + ], + "license": "MIT", + "main": "index.js", + "maintainers": [ + { + "name": "phated", + "email": "blaine.bublitz@gmail.com" + } + ], + "name": "clone-buffer", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/gulpjs/clone-buffer.git" + }, + "scripts": { + "cover": "istanbul cover _mocha --report lcovonly", + "coveralls": "npm run cover && istanbul-coveralls", + "lint": "eslint . && jscs index.js test/", + "pretest": "npm run lint", + "test": "mocha --async-only" + }, + "version": "1.0.0" +} |