refactor(typescript): Use ES6 import & use interface
parent
3c0a9e92f9
commit
a1eddb230f
@ -0,0 +1,18 @@
|
|||||||
|
export interface DecryptResult {
|
||||||
|
status: boolean,//todo: remove & use Exception
|
||||||
|
|
||||||
|
title: string
|
||||||
|
album?: string
|
||||||
|
artist?: string
|
||||||
|
|
||||||
|
mime: string
|
||||||
|
ext: string
|
||||||
|
|
||||||
|
file: string
|
||||||
|
picture: string
|
||||||
|
|
||||||
|
message?: string
|
||||||
|
rawExt?: string
|
||||||
|
rawFilename?: string
|
||||||
|
|
||||||
|
}
|
@ -1,9 +1,10 @@
|
|||||||
import {Decrypt as RawDecrypt} from "./raw";
|
import {Decrypt as RawDecrypt} from "./raw";
|
||||||
import {GetArrayBuffer} from "@/decrypt/utils.ts";
|
import {GetArrayBuffer} from "@/decrypt/utils.ts";
|
||||||
|
import {DecryptResult} from "@/decrypt/entity";
|
||||||
|
|
||||||
const TM_HEADER = [0x00, 0x00, 0x00, 0x20, 0x66, 0x74, 0x79, 0x70];
|
const TM_HEADER = [0x00, 0x00, 0x00, 0x20, 0x66, 0x74, 0x79, 0x70];
|
||||||
|
|
||||||
export async function Decrypt(file, raw_filename) {
|
export async function Decrypt(file: File, raw_filename: string): Promise<DecryptResult> {
|
||||||
const audioData = new Uint8Array(await GetArrayBuffer(file));
|
const audioData = new Uint8Array(await GetArrayBuffer(file));
|
||||||
for (let cur = 0; cur < 8; ++cur) {
|
for (let cur = 0; cur < 8; ++cur) {
|
||||||
audioData[cur] = TM_HEADER[cur];
|
audioData[cur] = TM_HEADER[cur];
|
Loading…
Reference in New Issue