first commit
This commit is contained in:
17
node_modules/data-uri-to-buffer/dist/common.d.ts
generated
vendored
Normal file
17
node_modules/data-uri-to-buffer/dist/common.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
export interface ParsedDataURI {
|
||||
type: string;
|
||||
typeFull: string;
|
||||
charset: string;
|
||||
buffer: ArrayBuffer;
|
||||
}
|
||||
export interface IBufferConversions {
|
||||
base64ToArrayBuffer(base64: string): ArrayBuffer;
|
||||
stringToBuffer(str: string): ArrayBuffer;
|
||||
}
|
||||
/**
|
||||
* Returns a `Buffer` instance from the given data URI `uri`.
|
||||
*
|
||||
* @param {String} uri Data URI to turn into a Buffer instance
|
||||
*/
|
||||
export declare const makeDataUriToBuffer: (convert: IBufferConversions) => (uri: string | URL) => ParsedDataURI;
|
||||
//# sourceMappingURL=common.d.ts.map
|
||||
1
node_modules/data-uri-to-buffer/dist/common.d.ts.map
generated
vendored
Normal file
1
node_modules/data-uri-to-buffer/dist/common.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IAClC,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC;IACjD,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC;CACzC;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,YAAa,kBAAkB,WAAW,MAAM,GAAG,GAAG,KAAG,aAmDxF,CAAA"}
|
||||
54
node_modules/data-uri-to-buffer/dist/common.js
generated
vendored
Normal file
54
node_modules/data-uri-to-buffer/dist/common.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.makeDataUriToBuffer = void 0;
|
||||
/**
|
||||
* Returns a `Buffer` instance from the given data URI `uri`.
|
||||
*
|
||||
* @param {String} uri Data URI to turn into a Buffer instance
|
||||
*/
|
||||
const makeDataUriToBuffer = (convert) => (uri) => {
|
||||
uri = String(uri);
|
||||
if (!/^data:/i.test(uri)) {
|
||||
throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');
|
||||
}
|
||||
// strip newlines
|
||||
uri = uri.replace(/\r?\n/g, '');
|
||||
// split the URI up into the "metadata" and the "data" portions
|
||||
const firstComma = uri.indexOf(',');
|
||||
if (firstComma === -1 || firstComma <= 4) {
|
||||
throw new TypeError('malformed data: URI');
|
||||
}
|
||||
// remove the "data:" scheme and parse the metadata
|
||||
const meta = uri.substring(5, firstComma).split(';');
|
||||
let charset = '';
|
||||
let base64 = false;
|
||||
const type = meta[0] || 'text/plain';
|
||||
let typeFull = type;
|
||||
for (let i = 1; i < meta.length; i++) {
|
||||
if (meta[i] === 'base64') {
|
||||
base64 = true;
|
||||
}
|
||||
else if (meta[i]) {
|
||||
typeFull += `;${meta[i]}`;
|
||||
if (meta[i].indexOf('charset=') === 0) {
|
||||
charset = meta[i].substring(8);
|
||||
}
|
||||
}
|
||||
}
|
||||
// defaults to US-ASCII only if type is not provided
|
||||
if (!meta[0] && !charset.length) {
|
||||
typeFull += ';charset=US-ASCII';
|
||||
charset = 'US-ASCII';
|
||||
}
|
||||
// get the encoded data portion and decode URI-encoded chars
|
||||
const data = unescape(uri.substring(firstComma + 1));
|
||||
const buffer = base64 ? convert.base64ToArrayBuffer(data) : convert.stringToBuffer(data);
|
||||
return {
|
||||
type,
|
||||
typeFull,
|
||||
charset,
|
||||
buffer,
|
||||
};
|
||||
};
|
||||
exports.makeDataUriToBuffer = makeDataUriToBuffer;
|
||||
//# sourceMappingURL=common.js.map
|
||||
1
node_modules/data-uri-to-buffer/dist/common.js.map
generated
vendored
Normal file
1
node_modules/data-uri-to-buffer/dist/common.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":";;;AAYA;;;;GAIG;AACI,MAAM,mBAAmB,GAAG,CAAC,OAA2B,EAAE,EAAE,CAAC,CAAC,GAAiB,EAAiB,EAAE;IACxG,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAElB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACzB,MAAM,IAAI,SAAS,CAClB,kEAAkE,CAClE,CAAC;KACF;IAED,iBAAiB;IACjB,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEhC,+DAA+D;IAC/D,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,UAAU,KAAK,CAAC,CAAC,IAAI,UAAU,IAAI,CAAC,EAAE;QACzC,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAC3C;IAED,mDAAmD;IACnD,MAAM,IAAI,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAErD,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC;IACrC,IAAI,QAAQ,GAAG,IAAI,CAAC;IACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;YACzB,MAAM,GAAG,IAAI,CAAC;SACd;aAAM,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE;YACnB,QAAQ,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1B,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;gBACtC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;aAC/B;SACD;KACD;IACD,oDAAoD;IACpD,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QAChC,QAAQ,IAAI,mBAAmB,CAAC;QAChC,OAAO,GAAG,UAAU,CAAC;KACrB;IAED,4DAA4D;IAC5D,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAEzF,OAAO;QACN,IAAI;QACJ,QAAQ;QACR,OAAO;QACP,MAAM;KACN,CAAC;AACH,CAAC,CAAA;AAnDY,QAAA,mBAAmB,uBAmD/B"}
|
||||
8
node_modules/data-uri-to-buffer/dist/index.d.ts
generated
vendored
Normal file
8
node_modules/data-uri-to-buffer/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export type { ParsedDataURI } from './common';
|
||||
/**
|
||||
* Returns a `Buffer` instance from the given data URI `uri`.
|
||||
*
|
||||
* @param {String} uri Data URI to turn into a Buffer instance
|
||||
*/
|
||||
export declare const dataUriToBuffer: (uri: string | URL) => import("./common").ParsedDataURI;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/data-uri-to-buffer/dist/index.d.ts.map
generated
vendored
Normal file
1
node_modules/data-uri-to-buffer/dist/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,aAAa,EAAE,MAAO,UAAU,CAAC;AAkD/C;;;;GAIG;AACH,eAAO,MAAM,eAAe,yDAA+D,CAAC"}
|
||||
48
node_modules/data-uri-to-buffer/dist/index.js
generated
vendored
Normal file
48
node_modules/data-uri-to-buffer/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.dataUriToBuffer = void 0;
|
||||
const common_1 = require("./common");
|
||||
function base64ToArrayBuffer(base64) {
|
||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||
const bytes = [];
|
||||
for (let i = 0; i < base64.length; i += 4) {
|
||||
const idx0 = chars.indexOf(base64.charAt(i));
|
||||
const idx1 = chars.indexOf(base64.charAt(i + 1));
|
||||
const idx2 = base64.charAt(i + 2) === '='
|
||||
? 0
|
||||
: chars.indexOf(base64.charAt(i + 2));
|
||||
const idx3 = base64.charAt(i + 3) === '='
|
||||
? 0
|
||||
: chars.indexOf(base64.charAt(i + 3));
|
||||
const bin0 = (idx0 << 2) | (idx1 >> 4);
|
||||
const bin1 = ((idx1 & 15) << 4) | (idx2 >> 2);
|
||||
const bin2 = ((idx2 & 3) << 6) | idx3;
|
||||
bytes.push(bin0);
|
||||
if (base64.charAt(i + 2) !== '=')
|
||||
bytes.push(bin1);
|
||||
if (base64.charAt(i + 3) !== '=')
|
||||
bytes.push(bin2);
|
||||
}
|
||||
const buffer = new ArrayBuffer(bytes.length);
|
||||
const view = new Uint8Array(buffer);
|
||||
view.set(bytes);
|
||||
return buffer;
|
||||
}
|
||||
function stringToBuffer(str) {
|
||||
// Create a buffer with length equal to the string length
|
||||
const buffer = new ArrayBuffer(str.length);
|
||||
// Create a view to manipulate the buffer content
|
||||
const view = new Uint8Array(buffer);
|
||||
// Iterate over the string and populate the buffer with ASCII codes
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
view[i] = str.charCodeAt(i);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
/**
|
||||
* Returns a `Buffer` instance from the given data URI `uri`.
|
||||
*
|
||||
* @param {String} uri Data URI to turn into a Buffer instance
|
||||
*/
|
||||
exports.dataUriToBuffer = (0, common_1.makeDataUriToBuffer)({ stringToBuffer, base64ToArrayBuffer });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/data-uri-to-buffer/dist/index.js.map
generated
vendored
Normal file
1
node_modules/data-uri-to-buffer/dist/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAA+C;AAI/C,SAAS,mBAAmB,CAAC,MAAc;IAC1C,MAAM,KAAK,GACV,kEAAkE,CAAC;IAEpE,MAAM,KAAK,GAAG,EAAE,CAAC;IAEjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7C,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACjD,MAAM,IAAI,GACT,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG;YAC3B,CAAC,CAAC,CAAC;YACH,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACxC,MAAM,IAAI,GACT,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG;YAC3B,CAAC,CAAC,CAAC;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pC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KAC5B;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;;;GAIG;AACU,QAAA,eAAe,GAAG,IAAA,4BAAmB,EAAC,EAAE,cAAc,EAAE,mBAAmB,EAAE,CAAC,CAAC"}
|
||||
8
node_modules/data-uri-to-buffer/dist/node.d.ts
generated
vendored
Normal file
8
node_modules/data-uri-to-buffer/dist/node.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export type { ParsedDataURI } from './common';
|
||||
/**
|
||||
* Returns a `Buffer` instance from the given data URI `uri`.
|
||||
*
|
||||
* @param {String} uri Data URI to turn into a Buffer instance
|
||||
*/
|
||||
export declare const dataUriToBuffer: (uri: string | URL) => import("./common").ParsedDataURI;
|
||||
//# sourceMappingURL=node.d.ts.map
|
||||
1
node_modules/data-uri-to-buffer/dist/node.d.ts.map
generated
vendored
Normal file
1
node_modules/data-uri-to-buffer/dist/node.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,aAAa,EAAE,MAAO,UAAU,CAAC;AAoB/C;;;;GAIG;AACH,eAAO,MAAM,eAAe,yDAA+D,CAAC"}
|
||||
26
node_modules/data-uri-to-buffer/dist/node.js
generated
vendored
Normal file
26
node_modules/data-uri-to-buffer/dist/node.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.dataUriToBuffer = void 0;
|
||||
const common_1 = require("./common");
|
||||
function nodeBuffertoArrayBuffer(nodeBuf) {
|
||||
if (nodeBuf.byteLength === nodeBuf.buffer.byteLength) {
|
||||
return nodeBuf.buffer; // large strings may get their own memory allocation
|
||||
}
|
||||
const buffer = new ArrayBuffer(nodeBuf.byteLength);
|
||||
const view = new Uint8Array(buffer);
|
||||
view.set(nodeBuf);
|
||||
return buffer;
|
||||
}
|
||||
function base64ToArrayBuffer(base64) {
|
||||
return nodeBuffertoArrayBuffer(Buffer.from(base64, 'base64'));
|
||||
}
|
||||
function stringToBuffer(str) {
|
||||
return nodeBuffertoArrayBuffer(Buffer.from(str, 'ascii'));
|
||||
}
|
||||
/**
|
||||
* Returns a `Buffer` instance from the given data URI `uri`.
|
||||
*
|
||||
* @param {String} uri Data URI to turn into a Buffer instance
|
||||
*/
|
||||
exports.dataUriToBuffer = (0, common_1.makeDataUriToBuffer)({ stringToBuffer, base64ToArrayBuffer });
|
||||
//# sourceMappingURL=node.js.map
|
||||
1
node_modules/data-uri-to-buffer/dist/node.js.map
generated
vendored
Normal file
1
node_modules/data-uri-to-buffer/dist/node.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":";;;AAAA,qCAA+C;AAI/C,SAAS,uBAAuB,CAAC,OAAe;IAC/C,IAAI,OAAO,CAAC,UAAU,KAAK,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE;QACrD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,oDAAoD;KAC3E;IACD,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACnD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAClB,OAAO,MAAM,CAAC;AACf,CAAC;AAED,SAAS,mBAAmB,CAAC,MAAc;IAC1C,OAAO,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,cAAc,CAAC,GAAW;IAClC,OAAO,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;GAIG;AACU,QAAA,eAAe,GAAG,IAAA,4BAAmB,EAAC,EAAE,cAAc,EAAE,mBAAmB,EAAE,CAAC,CAAC"}
|
||||
Reference in New Issue
Block a user