mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2026-01-26 17:02:00 +08:00
docs:更新文档
This commit is contained in:
35
node_modules/brotli-size/dist/index.d.ts
generated
vendored
Normal file
35
node_modules/brotli-size/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/// <reference types="node" />
|
||||
import { PassThrough as PassThroughStream } from 'stream';
|
||||
export interface BrotliEncodeParams {
|
||||
mode?: number;
|
||||
quality?: number;
|
||||
}
|
||||
/**
|
||||
* @param incoming Either a Buffer or string of the value to encode.
|
||||
* @param options Subset of Encoding Parameters.
|
||||
* @return Promise that resolves with the encoded Buffer length.
|
||||
*/
|
||||
export default function size(incoming: Buffer | string, options?: BrotliEncodeParams): Promise<number>;
|
||||
/**
|
||||
* @param incoming Either a Buffer or string of the value to encode.
|
||||
* @param options Subset of Encoding Parameters.
|
||||
* @return Length of encoded Buffer.
|
||||
*/
|
||||
export declare function sync(incoming: Buffer | string, options?: BrotliEncodeParams): number;
|
||||
/**
|
||||
* @param options
|
||||
* @return PassThroughStream for the contents being compressed
|
||||
*/
|
||||
export declare function stream(options?: BrotliEncodeParams): PassThroughStream;
|
||||
/**
|
||||
* @param path File Path for the file to compress.
|
||||
* @param options Subset of Encoding Parameters.
|
||||
* @return Promise that resolves with size of encoded file.
|
||||
*/
|
||||
export declare function file(path: string, options?: BrotliEncodeParams): Promise<number>;
|
||||
/**
|
||||
* @param path File Path for the file to compress.
|
||||
* @param options Subset of Encoding Parameters.
|
||||
* @return size of encoded file.
|
||||
*/
|
||||
export declare function fileSync(path: string, options?: BrotliEncodeParams): number;
|
||||
90
node_modules/brotli-size/dist/index.js
generated
vendored
Normal file
90
node_modules/brotli-size/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const zlib_1 = require("zlib");
|
||||
const stream_1 = require("stream");
|
||||
const fs_1 = require("fs");
|
||||
const util_1 = require("util");
|
||||
const duplexer = require('duplexer');
|
||||
const readFilePromise = util_1.promisify(fs_1.readFile);
|
||||
const bufferFormatter = (incoming) => typeof incoming === 'string' ? Buffer.from(incoming, 'utf8') : incoming;
|
||||
const optionFormatter = (passed, toEncode) => ({
|
||||
params: {
|
||||
[zlib_1.constants.BROTLI_PARAM_MODE]: passed && 'mode' in passed && passed.mode || zlib_1.constants.BROTLI_DEFAULT_MODE,
|
||||
[zlib_1.constants.BROTLI_PARAM_QUALITY]: passed && 'quality' in passed && passed.quality || zlib_1.constants.BROTLI_MAX_QUALITY,
|
||||
[zlib_1.constants.BROTLI_PARAM_SIZE_HINT]: toEncode ? toEncode.byteLength : 0,
|
||||
}
|
||||
});
|
||||
/**
|
||||
* @param incoming Either a Buffer or string of the value to encode.
|
||||
* @param options Subset of Encoding Parameters.
|
||||
* @return Promise that resolves with the encoded Buffer length.
|
||||
*/
|
||||
async function size(incoming, options) {
|
||||
const buffer = bufferFormatter(incoming);
|
||||
return new Promise(function (resolve, reject) {
|
||||
zlib_1.brotliCompress(buffer, optionFormatter(options, buffer), (error, result) => {
|
||||
if (error !== null) {
|
||||
reject(error);
|
||||
}
|
||||
resolve(result.byteLength);
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.default = size;
|
||||
/**
|
||||
* @param incoming Either a Buffer or string of the value to encode.
|
||||
* @param options Subset of Encoding Parameters.
|
||||
* @return Length of encoded Buffer.
|
||||
*/
|
||||
function sync(incoming, options) {
|
||||
const buffer = bufferFormatter(incoming);
|
||||
return zlib_1.brotliCompressSync(buffer, optionFormatter(options, buffer)).byteLength;
|
||||
}
|
||||
exports.sync = sync;
|
||||
/**
|
||||
* @param options
|
||||
* @return PassThroughStream for the contents being compressed
|
||||
*/
|
||||
function stream(options) {
|
||||
const input = new stream_1.PassThrough();
|
||||
const output = new stream_1.PassThrough();
|
||||
const wrapper = duplexer(input, output);
|
||||
let size = 0;
|
||||
const brotli = zlib_1.createBrotliCompress(optionFormatter(options))
|
||||
.on('data', buf => {
|
||||
size += buf.length;
|
||||
})
|
||||
.on('error', () => {
|
||||
wrapper.brotliSize = 0;
|
||||
})
|
||||
.on('end', () => {
|
||||
wrapper.brotliSize = size;
|
||||
wrapper.emit('brotli-size', size);
|
||||
output.end();
|
||||
});
|
||||
input.pipe(brotli);
|
||||
input.pipe(output, { end: false });
|
||||
return wrapper;
|
||||
}
|
||||
exports.stream = stream;
|
||||
/**
|
||||
* @param path File Path for the file to compress.
|
||||
* @param options Subset of Encoding Parameters.
|
||||
* @return Promise that resolves with size of encoded file.
|
||||
*/
|
||||
async function file(path, options) {
|
||||
const file = await readFilePromise(path);
|
||||
return (await size(file, options));
|
||||
}
|
||||
exports.file = file;
|
||||
/**
|
||||
* @param path File Path for the file to compress.
|
||||
* @param options Subset of Encoding Parameters.
|
||||
* @return size of encoded file.
|
||||
*/
|
||||
function fileSync(path, options) {
|
||||
const file = fs_1.readFileSync(path);
|
||||
return sync(file, options);
|
||||
}
|
||||
exports.fileSync = fileSync;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/brotli-size/dist/index.js.map
generated
vendored
Normal file
1
node_modules/brotli-size/dist/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,+BAA2H;AAC3H,mCAAwD;AACxD,2BAA0C;AAC1C,+BAA+B;AAE/B,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACrC,MAAM,eAAe,GAAG,gBAAS,CAAC,aAAQ,CAAC,CAAC;AAQ5C,MAAM,eAAe,GAAG,CAAC,QAAyB,EAAU,EAAE,CAAC,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AACvI,MAAM,eAAe,GAAG,CAAC,MAA2B,EAAE,QAAiB,EAAiB,EAAE,CA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AAHD,4BAGC"}
|
||||
1949
node_modules/brotli-size/dist/tsconfig.tsbuildinfo
generated
vendored
Normal file
1949
node_modules/brotli-size/dist/tsconfig.tsbuildinfo
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user