mirror of
https://github.com/musix-org/musix-oss
synced 2025-07-06 19:00:50 +00:00
fix
This commit is contained in:
21
node_modules/base64-js/LICENSE
generated
vendored
Normal file
21
node_modules/base64-js/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014
|
||||
|
||||
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.
|
34
node_modules/base64-js/README.md
generated
vendored
Normal file
34
node_modules/base64-js/README.md
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
base64-js
|
||||
=========
|
||||
|
||||
`base64-js` does basic base64 encoding/decoding in pure JS.
|
||||
|
||||
[](http://travis-ci.org/beatgammit/base64-js)
|
||||
|
||||
[](https://ci.testling.com/beatgammit/base64-js)
|
||||
|
||||
Many browsers already have base64 encoding/decoding functionality, but it is for text data, not all-purpose binary data.
|
||||
|
||||
Sometimes encoding/decoding binary data in the browser is useful, and that is what this module does.
|
||||
|
||||
## install
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
`npm install base64-js` and `var base64js = require('base64-js')`
|
||||
|
||||
For use in web browsers do:
|
||||
|
||||
`<script src="base64js.min.js"></script>`
|
||||
|
||||
## methods
|
||||
|
||||
`base64js` has three exposed functions, `byteLength`, `toByteArray` and `fromByteArray`, which both take a single argument.
|
||||
|
||||
* `byteLength` - Takes a base64 string and returns length of byte array
|
||||
* `toByteArray` - Takes a base64 string and returns a byte array
|
||||
* `fromByteArray` - Takes a byte array and returns a base64 string
|
||||
|
||||
## license
|
||||
|
||||
MIT
|
1
node_modules/base64-js/base64js.min.js
generated
vendored
Normal file
1
node_modules/base64-js/base64js.min.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
(function(r){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=r()}else if(typeof define==="function"&&define.amd){define([],r)}else{var e;if(typeof window!=="undefined"){e=window}else if(typeof global!=="undefined"){e=global}else if(typeof self!=="undefined"){e=self}else{e=this}e.base64js=r()}})(function(){var r,e,n;return function(){function r(e,n,t){function o(f,i){if(!n[f]){if(!e[f]){var u="function"==typeof require&&require;if(!i&&u)return u(f,!0);if(a)return a(f,!0);var v=new Error("Cannot find module '"+f+"'");throw v.code="MODULE_NOT_FOUND",v}var d=n[f]={exports:{}};e[f][0].call(d.exports,function(r){var n=e[f][1][r];return o(n||r)},d,d.exports,r,e,n,t)}return n[f].exports}for(var a="function"==typeof require&&require,f=0;f<t.length;f++)o(t[f]);return o}return r}()({"/":[function(r,e,n){"use strict";n.byteLength=d;n.toByteArray=h;n.fromByteArray=p;var t=[];var o=[];var a=typeof Uint8Array!=="undefined"?Uint8Array:Array;var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,u=f.length;i<u;++i){t[i]=f[i];o[f.charCodeAt(i)]=i}o["-".charCodeAt(0)]=62;o["_".charCodeAt(0)]=63;function v(r){var e=r.length;if(e%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var n=r.indexOf("=");if(n===-1)n=e;var t=n===e?0:4-n%4;return[n,t]}function d(r){var e=v(r);var n=e[0];var t=e[1];return(n+t)*3/4-t}function c(r,e,n){return(e+n)*3/4-n}function h(r){var e;var n=v(r);var t=n[0];var f=n[1];var i=new a(c(r,t,f));var u=0;var d=f>0?t-4:t;for(var h=0;h<d;h+=4){e=o[r.charCodeAt(h)]<<18|o[r.charCodeAt(h+1)]<<12|o[r.charCodeAt(h+2)]<<6|o[r.charCodeAt(h+3)];i[u++]=e>>16&255;i[u++]=e>>8&255;i[u++]=e&255}if(f===2){e=o[r.charCodeAt(h)]<<2|o[r.charCodeAt(h+1)]>>4;i[u++]=e&255}if(f===1){e=o[r.charCodeAt(h)]<<10|o[r.charCodeAt(h+1)]<<4|o[r.charCodeAt(h+2)]>>2;i[u++]=e>>8&255;i[u++]=e&255}return i}function s(r){return t[r>>18&63]+t[r>>12&63]+t[r>>6&63]+t[r&63]}function l(r,e,n){var t;var o=[];for(var a=e;a<n;a+=3){t=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255);o.push(s(t))}return o.join("")}function p(r){var e;var n=r.length;var o=n%3;var a=[];var f=16383;for(var i=0,u=n-o;i<u;i+=f){a.push(l(r,i,i+f>u?u:i+f))}if(o===1){e=r[n-1];a.push(t[e>>2]+t[e<<4&63]+"==")}else if(o===2){e=(r[n-2]<<8)+r[n-1];a.push(t[e>>10]+t[e>>4&63]+t[e<<2&63]+"=")}return a.join("")}},{}]},{},[])("/")});
|
151
node_modules/base64-js/index.js
generated
vendored
Normal file
151
node_modules/base64-js/index.js
generated
vendored
Normal file
@ -0,0 +1,151 @@
|
||||
'use strict'
|
||||
|
||||
exports.byteLength = byteLength
|
||||
exports.toByteArray = toByteArray
|
||||
exports.fromByteArray = fromByteArray
|
||||
|
||||
var lookup = []
|
||||
var revLookup = []
|
||||
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
|
||||
|
||||
var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
||||
for (var i = 0, len = code.length; i < len; ++i) {
|
||||
lookup[i] = code[i]
|
||||
revLookup[code.charCodeAt(i)] = i
|
||||
}
|
||||
|
||||
// Support decoding URL-safe base64 strings, as Node.js does.
|
||||
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
|
||||
revLookup['-'.charCodeAt(0)] = 62
|
||||
revLookup['_'.charCodeAt(0)] = 63
|
||||
|
||||
function getLens (b64) {
|
||||
var len = b64.length
|
||||
|
||||
if (len % 4 > 0) {
|
||||
throw new Error('Invalid string. Length must be a multiple of 4')
|
||||
}
|
||||
|
||||
// Trim off extra bytes after placeholder bytes are found
|
||||
// See: https://github.com/beatgammit/base64-js/issues/42
|
||||
var validLen = b64.indexOf('=')
|
||||
if (validLen === -1) validLen = len
|
||||
|
||||
var placeHoldersLen = validLen === len
|
||||
? 0
|
||||
: 4 - (validLen % 4)
|
||||
|
||||
return [validLen, placeHoldersLen]
|
||||
}
|
||||
|
||||
// base64 is 4/3 + up to two characters of the original data
|
||||
function byteLength (b64) {
|
||||
var lens = getLens(b64)
|
||||
var validLen = lens[0]
|
||||
var placeHoldersLen = lens[1]
|
||||
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
||||
}
|
||||
|
||||
function _byteLength (b64, validLen, placeHoldersLen) {
|
||||
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
|
||||
}
|
||||
|
||||
function toByteArray (b64) {
|
||||
var tmp
|
||||
var lens = getLens(b64)
|
||||
var validLen = lens[0]
|
||||
var placeHoldersLen = lens[1]
|
||||
|
||||
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
|
||||
|
||||
var curByte = 0
|
||||
|
||||
// if there are placeholders, only get up to the last complete 4 chars
|
||||
var len = placeHoldersLen > 0
|
||||
? validLen - 4
|
||||
: validLen
|
||||
|
||||
for (var i = 0; i < len; i += 4) {
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 18) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] << 12) |
|
||||
(revLookup[b64.charCodeAt(i + 2)] << 6) |
|
||||
revLookup[b64.charCodeAt(i + 3)]
|
||||
arr[curByte++] = (tmp >> 16) & 0xFF
|
||||
arr[curByte++] = (tmp >> 8) & 0xFF
|
||||
arr[curByte++] = tmp & 0xFF
|
||||
}
|
||||
|
||||
if (placeHoldersLen === 2) {
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 2) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] >> 4)
|
||||
arr[curByte++] = tmp & 0xFF
|
||||
}
|
||||
|
||||
if (placeHoldersLen === 1) {
|
||||
tmp =
|
||||
(revLookup[b64.charCodeAt(i)] << 10) |
|
||||
(revLookup[b64.charCodeAt(i + 1)] << 4) |
|
||||
(revLookup[b64.charCodeAt(i + 2)] >> 2)
|
||||
arr[curByte++] = (tmp >> 8) & 0xFF
|
||||
arr[curByte++] = tmp & 0xFF
|
||||
}
|
||||
|
||||
return arr
|
||||
}
|
||||
|
||||
function tripletToBase64 (num) {
|
||||
return lookup[num >> 18 & 0x3F] +
|
||||
lookup[num >> 12 & 0x3F] +
|
||||
lookup[num >> 6 & 0x3F] +
|
||||
lookup[num & 0x3F]
|
||||
}
|
||||
|
||||
function encodeChunk (uint8, start, end) {
|
||||
var tmp
|
||||
var output = []
|
||||
for (var i = start; i < end; i += 3) {
|
||||
tmp =
|
||||
((uint8[i] << 16) & 0xFF0000) +
|
||||
((uint8[i + 1] << 8) & 0xFF00) +
|
||||
(uint8[i + 2] & 0xFF)
|
||||
output.push(tripletToBase64(tmp))
|
||||
}
|
||||
return output.join('')
|
||||
}
|
||||
|
||||
function fromByteArray (uint8) {
|
||||
var tmp
|
||||
var len = uint8.length
|
||||
var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
|
||||
var parts = []
|
||||
var maxChunkLength = 16383 // must be multiple of 3
|
||||
|
||||
// go through the array every three bytes, we'll deal with trailing stuff later
|
||||
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
|
||||
parts.push(encodeChunk(
|
||||
uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
|
||||
))
|
||||
}
|
||||
|
||||
// pad the end with zeros, but make sure to not forget the extra bytes
|
||||
if (extraBytes === 1) {
|
||||
tmp = uint8[len - 1]
|
||||
parts.push(
|
||||
lookup[tmp >> 2] +
|
||||
lookup[(tmp << 4) & 0x3F] +
|
||||
'=='
|
||||
)
|
||||
} else if (extraBytes === 2) {
|
||||
tmp = (uint8[len - 2] << 8) + uint8[len - 1]
|
||||
parts.push(
|
||||
lookup[tmp >> 10] +
|
||||
lookup[(tmp >> 4) & 0x3F] +
|
||||
lookup[(tmp << 2) & 0x3F] +
|
||||
'='
|
||||
)
|
||||
}
|
||||
|
||||
return parts.join('')
|
||||
}
|
65
node_modules/base64-js/package.json
generated
vendored
Normal file
65
node_modules/base64-js/package.json
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
{
|
||||
"_from": "base64-js@^1.0.2",
|
||||
"_id": "base64-js@1.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==",
|
||||
"_location": "/base64-js",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "base64-js@^1.0.2",
|
||||
"name": "base64-js",
|
||||
"escapedName": "base64-js",
|
||||
"rawSpec": "^1.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/buffer"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz",
|
||||
"_shasum": "cab1e6118f051095e58b5281aea8c1cd22bfc0e3",
|
||||
"_spec": "base64-js@^1.0.2",
|
||||
"_where": "C:\\Users\\matia\\Musix\\node_modules\\buffer",
|
||||
"author": {
|
||||
"name": "T. Jameson Little",
|
||||
"email": "t.jameson.little@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/beatgammit/base64-js/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Base64 encoding/decoding in pure JS",
|
||||
"devDependencies": {
|
||||
"benchmark": "^2.1.4",
|
||||
"browserify": "^14.0.0",
|
||||
"standard": "*",
|
||||
"tape": "4.x",
|
||||
"uglify-js": "^2.8.29"
|
||||
},
|
||||
"files": [
|
||||
"test",
|
||||
"index.js",
|
||||
"base64js.min.js"
|
||||
],
|
||||
"homepage": "https://github.com/beatgammit/base64-js",
|
||||
"keywords": [
|
||||
"base64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "base64-js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/beatgammit/base64-js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "browserify -s base64js -r ./ | uglifyjs -m > base64js.min.js",
|
||||
"lint": "standard",
|
||||
"test": "npm run lint && npm run unit",
|
||||
"unit": "tape test/*.js"
|
||||
},
|
||||
"version": "1.3.0"
|
||||
}
|
25
node_modules/base64-js/test/big-data.js
generated
vendored
Normal file
25
node_modules/base64-js/test/big-data.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
var test = require('tape')
|
||||
var b64 = require('../')
|
||||
|
||||
test('convert big data to base64', function (t) {
|
||||
var b64str, arr, i, length
|
||||
var big = new Uint8Array(64 * 1024 * 1024)
|
||||
for (i = 0, length = big.length; i < length; ++i) {
|
||||
big[i] = i % 256
|
||||
}
|
||||
b64str = b64.fromByteArray(big)
|
||||
arr = b64.toByteArray(b64str)
|
||||
t.ok(equal(arr, big))
|
||||
t.equal(b64.byteLength(b64str), arr.length)
|
||||
t.end()
|
||||
})
|
||||
|
||||
function equal (a, b) {
|
||||
var i
|
||||
var length = a.length
|
||||
if (length !== b.length) return false
|
||||
for (i = 0; i < length; ++i) {
|
||||
if (a[i] !== b[i]) return false
|
||||
}
|
||||
return true
|
||||
}
|
88
node_modules/base64-js/test/convert.js
generated
vendored
Normal file
88
node_modules/base64-js/test/convert.js
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
var test = require('tape')
|
||||
var b64 = require('../')
|
||||
var checks = [
|
||||
'a',
|
||||
'aa',
|
||||
'aaa',
|
||||
'hi',
|
||||
'hi!',
|
||||
'hi!!',
|
||||
'sup',
|
||||
'sup?',
|
||||
'sup?!'
|
||||
]
|
||||
|
||||
test('convert to base64 and back', function (t) {
|
||||
t.plan(checks.length * 2)
|
||||
|
||||
for (var i = 0; i < checks.length; i++) {
|
||||
var check = checks[i]
|
||||
var b64Str, arr, str
|
||||
|
||||
b64Str = b64.fromByteArray(map(check, function (char) { return char.charCodeAt(0) }))
|
||||
|
||||
arr = b64.toByteArray(b64Str)
|
||||
str = map(arr, function (byte) { return String.fromCharCode(byte) }).join('')
|
||||
|
||||
t.equal(check, str, 'Checked ' + check)
|
||||
t.equal(b64.byteLength(b64Str), arr.length, 'Checked length for ' + check)
|
||||
}
|
||||
})
|
||||
|
||||
var data = [
|
||||
[[0, 0, 0], 'AAAA'],
|
||||
[[0, 0, 1], 'AAAB'],
|
||||
[[0, 1, -1], 'AAH/'],
|
||||
[[1, 1, 1], 'AQEB'],
|
||||
[[0, -73, 23], 'ALcX']
|
||||
]
|
||||
|
||||
test('convert known data to string', function (t) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var bytes = data[i][0]
|
||||
var expected = data[i][1]
|
||||
var actual = b64.fromByteArray(bytes)
|
||||
t.equal(actual, expected, 'Ensure that ' + bytes + ' serialise to ' + expected)
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('convert known data from string', function (t) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var expected = data[i][0]
|
||||
var string = data[i][1]
|
||||
var actual = b64.toByteArray(string)
|
||||
t.ok(equal(actual, expected), 'Ensure that ' + string + ' deserialise to ' + expected)
|
||||
var length = b64.byteLength(string)
|
||||
t.equal(length, expected.length, 'Ensure that ' + string + ' has byte lentgh of ' + expected.length)
|
||||
}
|
||||
t.end()
|
||||
})
|
||||
|
||||
function equal (a, b) {
|
||||
var i
|
||||
var length = a.length
|
||||
if (length !== b.length) return false
|
||||
for (i = 0; i < length; ++i) {
|
||||
if ((a[i] & 0xFF) !== (b[i] & 0xFF)) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function map (arr, callback) {
|
||||
var res = []
|
||||
var kValue, mappedValue
|
||||
|
||||
for (var k = 0, len = arr.length; k < len; k++) {
|
||||
if ((typeof arr === 'string' && !!arr.charAt(k))) {
|
||||
kValue = arr.charAt(k)
|
||||
mappedValue = callback(kValue, k, arr)
|
||||
res[k] = mappedValue
|
||||
} else if (typeof arr !== 'string' && k in arr) {
|
||||
kValue = arr[k]
|
||||
mappedValue = callback(kValue, k, arr)
|
||||
res[k] = mappedValue
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
10
node_modules/base64-js/test/corrupt.js
generated
vendored
Normal file
10
node_modules/base64-js/test/corrupt.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
var test = require('tape')
|
||||
var b64 = require('../')
|
||||
|
||||
test('padding bytes found inside base64 string', function (t) {
|
||||
// See https://github.com/beatgammit/base64-js/issues/42
|
||||
var str = 'SQ==QU0='
|
||||
t.deepEqual(b64.toByteArray(str), new Uint8Array([73]))
|
||||
t.equal(b64.byteLength(str), 1)
|
||||
t.end()
|
||||
})
|
24
node_modules/base64-js/test/url-safe.js
generated
vendored
Normal file
24
node_modules/base64-js/test/url-safe.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
var test = require('tape')
|
||||
var b64 = require('../')
|
||||
|
||||
test('decode url-safe style base64 strings', function (t) {
|
||||
var expected = [0xff, 0xff, 0xbe, 0xff, 0xef, 0xbf, 0xfb, 0xef, 0xff]
|
||||
|
||||
var str = '//++/++/++//'
|
||||
var actual = b64.toByteArray(str)
|
||||
for (var i = 0; i < actual.length; i++) {
|
||||
t.equal(actual[i], expected[i])
|
||||
}
|
||||
|
||||
t.equal(b64.byteLength(str), actual.length)
|
||||
|
||||
str = '__--_--_--__'
|
||||
actual = b64.toByteArray(str)
|
||||
for (i = 0; i < actual.length; i++) {
|
||||
t.equal(actual[i], expected[i])
|
||||
}
|
||||
|
||||
t.equal(b64.byteLength(str), actual.length)
|
||||
|
||||
t.end()
|
||||
})
|
Reference in New Issue
Block a user