加入了pako和axios的测试。
This commit is contained in:
		@@ -2,7 +2,7 @@
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-02-10 15:08:53
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @LastEditTime: 2023-02-13 00:40:30
 | 
			
		||||
 * @LastEditTime: 2023-02-13 10:04:33
 | 
			
		||||
 * @FilePath: /后端辅助工具/src/DataType/DataType.ts
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
@@ -61,6 +61,12 @@ function dataTypes()
 | 
			
		||||
    overplusArugsWithTuple(1, 2, 3, "test");
 | 
			
		||||
 | 
			
		||||
    console.log(overplusArgusWithArray(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
 | 
			
		||||
 | 
			
		||||
    //测试null
 | 
			
		||||
    const nulltest: null = null;
 | 
			
		||||
    let var_2: { x: string; } = { x: "test", };
 | 
			
		||||
 | 
			
		||||
    // var_2 = null;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								code/ts/后端辅助工具/src/axios/AxiosTest.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								code/ts/后端辅助工具/src/axios/AxiosTest.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-02-13 15:46:17
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @LastEditTime: 2023-02-13 15:46:17
 | 
			
		||||
 * @FilePath: /后端辅助工具/src/axios/AxiosTest.js
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
import axios from "axios";
 | 
			
		||||
							
								
								
									
										19
									
								
								code/ts/后端辅助工具/src/axios/request.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								code/ts/后端辅助工具/src/axios/request.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-02-13 15:53:45
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @LastEditTime: 2023-02-13 15:56:26
 | 
			
		||||
 * @FilePath: /后端辅助工具/src/axios/request.ts
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
import axios, { AxiosInstance } from "axios";
 | 
			
		||||
 | 
			
		||||
const service = axios.create({
 | 
			
		||||
    baseURL: "",
 | 
			
		||||
    timeout: 10000,
 | 
			
		||||
    timeoutErrorMessage: "请求超时!",
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										27
									
								
								code/ts/后端辅助工具/src/gzip/PakoTest.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								code/ts/后端辅助工具/src/gzip/PakoTest.ts
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -2,7 +2,7 @@
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-02-09 22:14:30
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @LastEditTime: 2023-02-12 23:52:33
 | 
			
		||||
 * @LastEditTime: 2023-02-13 15:59:43
 | 
			
		||||
 * @FilePath: /后端辅助工具/src/main.ts
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
@@ -10,10 +10,12 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
import { dataTypes } from "./DataType/DataType";
 | 
			
		||||
import { pakoTest } from "./gzip/PakoTest";
 | 
			
		||||
 | 
			
		||||
const greetings = "hello, this is kane's typescript!";
 | 
			
		||||
 | 
			
		||||
console.log(greetings);
 | 
			
		||||
console.log("all");
 | 
			
		||||
 | 
			
		||||
dataTypes();
 | 
			
		||||
//dataTypes();
 | 
			
		||||
pakoTest();
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										38
									
								
								code/ts/后端辅助工具/src/utils/StringConvert.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								code/ts/后端辅助工具/src/utils/StringConvert.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
/*
 | 
			
		||||
 * @Author: Kane
 | 
			
		||||
 * @Date: 2023-02-13 14:54:46
 | 
			
		||||
 * @LastEditors: Kane
 | 
			
		||||
 * @LastEditTime: 2023-02-13 14:55:19
 | 
			
		||||
 * @FilePath: /pako/src/utils/StringConverter.js
 | 
			
		||||
 * @Description: 
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
function Uint8ArrayToString(fileData: Uint8Array): string
 | 
			
		||||
{
 | 
			
		||||
    let dataString: string = "";
 | 
			
		||||
 | 
			
		||||
    for (let i = 0; i < fileData.length; i++)
 | 
			
		||||
    {
 | 
			
		||||
        dataString += String.fromCharCode(fileData[i]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return dataString;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function stringToUint8Array(str: string): Uint8Array
 | 
			
		||||
{
 | 
			
		||||
    const arr: number[] = [];
 | 
			
		||||
 | 
			
		||||
    for (let i = 0, j = str.length; i < j; ++i)
 | 
			
		||||
    {
 | 
			
		||||
        arr.push(str.charCodeAt(i));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const tmpUint8Array: Uint8Array = new Uint8Array(arr);
 | 
			
		||||
 | 
			
		||||
    return tmpUint8Array;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export { Uint8ArrayToString, stringToUint8Array };
 | 
			
		||||
		Reference in New Issue
	
	Block a user