full site update
This commit is contained in:
20
node_modules/blob-to-buffer/LICENSE
generated
vendored
Normal file
20
node_modules/blob-to-buffer/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Feross Aboukhadijeh
|
||||
|
||||
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.
|
52
node_modules/blob-to-buffer/README.md
generated
vendored
Normal file
52
node_modules/blob-to-buffer/README.md
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
# blob-to-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
|
||||
|
||||
[travis-image]: https://img.shields.io/travis/feross/blob-to-buffer/master.svg
|
||||
[travis-url]: https://travis-ci.org/feross/blob-to-buffer
|
||||
[npm-image]: https://img.shields.io/npm/v/blob-to-buffer.svg
|
||||
[npm-url]: https://npmjs.org/package/blob-to-buffer
|
||||
[downloads-image]: https://img.shields.io/npm/dm/blob-to-buffer.svg
|
||||
[downloads-url]: https://npmjs.org/package/blob-to-buffer
|
||||
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
|
||||
[standard-url]: https://standardjs.com
|
||||
|
||||
#### Convert a Blob to a [Buffer](https://github.com/feross/buffer).
|
||||
|
||||
[](https://saucelabs.com/u/blob-to-buffer)
|
||||
|
||||
Say you're using the ['buffer'](https://github.com/feross/buffer) module on npm, or
|
||||
[browserify](http://browserify.org/) and you're working with lots of binary data.
|
||||
|
||||
Unfortunately, sometimes the browser or someone else's API gives you a `Blob`. Silly
|
||||
browser. How do you convert it to a `Buffer`?
|
||||
|
||||
Something with a goofy `FileReader` thingy... Time to Google for it yet again... There must be a better way!
|
||||
|
||||
***There is! Simply use this module!***
|
||||
|
||||
Works in the browser. This module is used by [WebTorrent](http://webtorrent.io)!
|
||||
|
||||
### install
|
||||
|
||||
```
|
||||
npm install blob-to-buffer
|
||||
```
|
||||
|
||||
### usage
|
||||
|
||||
```js
|
||||
var toBuffer = require('blob-to-buffer')
|
||||
|
||||
// Get a Blob somehow...
|
||||
var blob = new Blob([ new Uint8Array([1, 2, 3]) ], { type: 'application/octet-binary' })
|
||||
|
||||
toBuffer(blob, function (err, buffer) {
|
||||
if (err) throw err
|
||||
|
||||
buffer[0] // => 1
|
||||
buffer.readUInt8(1) // => 2
|
||||
})
|
||||
```
|
||||
|
||||
### license
|
||||
|
||||
MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).
|
22
node_modules/blob-to-buffer/index.js
generated
vendored
Normal file
22
node_modules/blob-to-buffer/index.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*! blob-to-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
/* global Blob, FileReader */
|
||||
|
||||
module.exports = function blobToBuffer (blob, cb) {
|
||||
if (typeof Blob === 'undefined' || !(blob instanceof Blob)) {
|
||||
throw new Error('first argument must be a Blob')
|
||||
}
|
||||
if (typeof cb !== 'function') {
|
||||
throw new Error('second argument must be a function')
|
||||
}
|
||||
|
||||
const reader = new FileReader()
|
||||
|
||||
function onLoadEnd (e) {
|
||||
reader.removeEventListener('loadend', onLoadEnd, false)
|
||||
if (e.error) cb(e.error)
|
||||
else cb(null, Buffer.from(reader.result))
|
||||
}
|
||||
|
||||
reader.addEventListener('loadend', onLoadEnd, false)
|
||||
reader.readAsArrayBuffer(blob)
|
||||
}
|
52
node_modules/blob-to-buffer/package.json
generated
vendored
Normal file
52
node_modules/blob-to-buffer/package.json
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "blob-to-buffer",
|
||||
"description": "Convert a Blob to a Buffer",
|
||||
"version": "1.2.9",
|
||||
"author": {
|
||||
"name": "Feross Aboukhadijeh",
|
||||
"email": "feross@feross.org",
|
||||
"url": "https://feross.org"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/feross/blob-to-buffer/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"airtap": "^3.0.0",
|
||||
"standard": "*",
|
||||
"tape": "^5.0.1"
|
||||
},
|
||||
"homepage": "https://github.com/feross/blob-to-buffer",
|
||||
"keywords": [
|
||||
"blob",
|
||||
"browserify",
|
||||
"buffer",
|
||||
"convert",
|
||||
"filereader"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/feross/blob-to-buffer.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && npm run test-browser",
|
||||
"test-browser": "airtap -- test/*.js",
|
||||
"test-browser-local": "airtap --local -- test/*.js"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user