Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/CommonFormats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export const Category = {
SPREADSHEET: "spreadsheet",
PRESENTATION: "presentation",
FONT: "font",
CODE: "code"
CODE: "code",
DATABASE: "database",
MODEL: "model",
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/handlers/FFmpeg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { LogEvent } from "@ffmpeg/ffmpeg";

import mime from "mime";
import normalizeMimeType from "../normalizeMimeType.ts";
import CommonFormats from "src/CommonFormats.ts";
import CommonFormats, { Category } from "src/CommonFormats.ts";

class FFmpegHandler implements FormatHandler {

Expand Down Expand Up @@ -220,7 +220,7 @@ class FFmpegHandler implements FormatHandler {
from: true,
to: true,
internal: "mov",
category: "audio",
category: Category.AUDIO,
lossless: false
});

Expand All @@ -233,7 +233,7 @@ class FFmpegHandler implements FormatHandler {
from: true,
to: true,
internal: "asf",
category: "video"
category: Category.VIDEO
});

// Normalize Bink metadata to ensure ".bik" files are detected by extension.
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/als.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts";
import CommonFormats from "src/CommonFormats.ts";
import CommonFormats, { Category } from "src/CommonFormats.ts";

class alsHandler implements FormatHandler {

Expand All @@ -14,7 +14,7 @@ class alsHandler implements FormatHandler {
from: true,
to: false,
internal: "als",
category: "data",
category: Category.DATA,
lossless: true
},
CommonFormats.XML.builder("xml").allowTo(),
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/aperturePicture.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts";
import CommonFormats from "src/CommonFormats.ts";
import CommonFormats, { Category } from "src/CommonFormats.ts";

class aperturePictureHandler implements FormatHandler {
public name: string = "aperturePicture";
Expand All @@ -16,7 +16,7 @@ class aperturePictureHandler implements FormatHandler {
from: true,
to: false,
internal: "apf",
category: ["image"],
category: Category.IMAGE,
lossless: true,
},
CommonFormats.BMP.builder("bmp")
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/aseprite.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pako from "pako";
import CommonFormats from "src/CommonFormats.ts";
import CommonFormats, { Category } from "src/CommonFormats.ts";
import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts";

const ASEPRITE_HEADER_MAGIC = 0xA5E0;
Expand Down Expand Up @@ -418,7 +418,7 @@ class asepriteHandler implements FormatHandler {
from: true,
to: false,
internal: "aseprite",
category: "image",
category: Category.IMAGE,
lossless: true
},
CommonFormats.PNG.supported("png", false, true, true),
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/bsor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts";
import { Replay } from "./bsor/replay.ts";
import { render } from "./bsor/renderer.ts";
import CommonFormats from "src/CommonFormats.ts";
import CommonFormats, { Category } from "src/CommonFormats.ts";

class bsorHandler implements FormatHandler {
public name: string = "bsor";
Expand All @@ -14,7 +14,7 @@ class bsorHandler implements FormatHandler {
from: true,
to: false,
internal: "bsor",
category: "data",
category: Category.DATA,
lossless: false
},
CommonFormats.PNG.supported("png", false, true),
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/bunburrows.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// file: bunburrows.ts

import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts";
import CommonFormats from "src/CommonFormats.ts";
import CommonFormats, { Category } from "src/CommonFormats.ts";

const COLOR_WALKABLE = [0,0,0];
const COLOR_BREAKABLE = [98,135,64];
Expand All @@ -28,7 +28,7 @@ class bunburrowsHandler implements FormatHandler {
from: true,
to: false,
internal: "bunlevel",
category: "data",
category: Category.DATA,
lossless: false,
},
];
Expand Down
8 changes: 4 additions & 4 deletions src/handlers/celariaMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { PlayerSpawnPoint } from "celaria-formats/class/maps/objects/PlayerSpawn
import { Sphere } from "celaria-formats/class/maps/objects/Sphere.mjs"
import { TutorialHologram } from "celaria-formats/class/maps/objects/TutorialHologram.mjs"
import type { FlatVector3, Vector3 } from "celaria-formats/types/data.mts"
import CommonFormats from "src/CommonFormats.ts"
import CommonFormats, { Category } from "src/CommonFormats.ts"
import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts"

class celariaMapHandler implements FormatHandler {
Expand All @@ -25,7 +25,7 @@ class celariaMapHandler implements FormatHandler {
from: false,
to: true,
internal: "obj",
category: "model",
category: Category.MODEL,
lossless: false,
},
CommonFormats.JSON.builder("json").allowFrom(true).allowTo(true).markLossless(false),
Expand All @@ -37,7 +37,7 @@ class celariaMapHandler implements FormatHandler {
from: true,
to: true,
internal: "ecmap",
category: "data",
category: Category.DATA,
lossless: false,
},
{
Expand All @@ -48,7 +48,7 @@ class celariaMapHandler implements FormatHandler {
from: true,
to: false,
internal: "cmap",
category: "data",
category: Category.DATA,
lossless: false,
},
]
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/cgbi-to-png.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pako from "pako";
import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts";
import CommonFormats from "src/CommonFormats.ts";
import CommonFormats, { Category } from "src/CommonFormats.ts";

async function revertCgBIBuffer(input: Uint8Array | ArrayBuffer): Promise<Uint8Array> {
const buffer = input instanceof Uint8Array ? input : new Uint8Array(input);
Expand Down Expand Up @@ -156,7 +156,7 @@ class cgbiToPngHandler implements FormatHandler {
from: true,
to: false,
internal: "cgbi-png",
category: "image",
category: Category.IMAGE,
lossless: true
},
CommonFormats.PNG.supported("png", false, true, true),
Expand Down
8 changes: 4 additions & 4 deletions src/handlers/curani.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// file: curani.ts

import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts";
import CommonFormats from "src/CommonFormats.ts";
import CommonFormats, { Category } from "src/CommonFormats.ts";

function read_lendian(x : number, y: number): number {
return x + (y * 16 * 16);
Expand All @@ -23,7 +23,7 @@ class curaniHandler implements FormatHandler {
from: true,
to: true,
internal: "ani",
category: "image",
category: Category.IMAGE,
lossless: false,
},
{
Expand All @@ -34,7 +34,7 @@ class curaniHandler implements FormatHandler {
from: true,
to: true,
internal: "cur",
category: "image",
category: Category.IMAGE,
lossless: false,
},
{
Expand All @@ -45,7 +45,7 @@ class curaniHandler implements FormatHandler {
from: true,
to: true,
internal: "ico",
category: "image",
category: Category.IMAGE,
lossless: false,
}
];
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/cybergrindHandler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts";
import CommonFormats from "src/CommonFormats.ts";
import CommonFormats, { Category } from "src/CommonFormats.ts";

class cybergrindHandler implements FormatHandler {
public name: string = "cybergrind";
Expand All @@ -17,7 +17,7 @@ class cybergrindHandler implements FormatHandler {
format: "cgp",
extension: "cgp",
mime: "text/plain",
category: "data",
category: Category.DATA,
from: false,
to: true,
internal: "cgp",
Expand Down
8 changes: 4 additions & 4 deletions src/handlers/envelope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { parseODT, parseODP, parseODS } from "./envelope/parseODF.js";
import parseDOCX from "./envelope/parseDOCX.js";
import parsePPTX from "./envelope/parsePPTX.js";
import parseXLSX from "./envelope/parseXLSX.js";
import CommonFormats from "src/CommonFormats.ts";
import CommonFormats, { Category } from "src/CommonFormats.ts";

class envelopeHandler implements FormatHandler {

Expand All @@ -23,7 +23,7 @@ class envelopeHandler implements FormatHandler {
from: true,
to: false,
internal: "odt",
category: "document",
category: Category.DOCUMENT,
lossless: false
},
{
Expand All @@ -34,7 +34,7 @@ class envelopeHandler implements FormatHandler {
from: true,
to: false,
internal: "odp",
category: "presentation",
category: Category.PRESENTATION,
lossless: false
},
{
Expand All @@ -45,7 +45,7 @@ class envelopeHandler implements FormatHandler {
from: true,
to: false,
internal: "ods",
category: "spreadsheet",
category: Category.SPREADSHEET,
lossless: false
},
// Technically not "lossless", but it's about as close as we'll ever get
Expand Down
6 changes: 3 additions & 3 deletions src/handlers/flo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts";
import normalizeMimeType from "../normalizeMimeType.ts";
import CommonFormats from "src/CommonFormats.ts";
import CommonFormats, { Category } from "src/CommonFormats.ts";
import { FFmpeg } from "@ffmpeg/ffmpeg";

function interleaveAudioBuffer(buffer: AudioBuffer): Float32Array {
Expand Down Expand Up @@ -187,7 +187,7 @@ class floHandler implements FormatHandler {
from: true,
to: true,
internal: "flo",
category: "audio",
category: Category.AUDIO,
lossless: false
},
CommonFormats.WAV.builder("wav")
Expand All @@ -200,7 +200,7 @@ class floHandler implements FormatHandler {
from: true,
to: true,
internal: "f32le",
category: "audio",
category: Category.AUDIO,
lossless: true
},
];
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/flptojson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts";
import { Buffer } from "buffer";
import CommonFormats from "src/CommonFormats.ts";
import CommonFormats, { Category } from "src/CommonFormats.ts";

if (typeof window !== "undefined") {
(window as any).Buffer = Buffer;
Expand Down Expand Up @@ -32,7 +32,7 @@ class flptojsonHandler implements FormatHandler {
from: true,
to: false,
internal: "flp",
category: "audio",
category: Category.AUDIO,
lossless: false,
},
// Unsure about this, it might be lossless
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/jsonToC.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts";
import {JsonType} from "./jsonToC/JsonType.ts";
import JsonTypeFactory from "./jsonToC/JsonTypeFactory.ts";
import CommonFormats from "src/CommonFormats.ts";
import CommonFormats, { Category } from "src/CommonFormats.ts";

export default class jsonToCHandler implements FormatHandler {
/**************************************************/
Expand All @@ -18,7 +18,7 @@ export default class jsonToCHandler implements FormatHandler {
from: true,
to: true,
internal: "c",
category: "code"
category: Category.CODE
},
CommonFormats.JSON.supported("json", true, true)
];
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/libopenmpt.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts";
import CommonFormats from "src/CommonFormats.ts";
import CommonFormats, { Category } from "src/CommonFormats.ts";

interface LibOpenMPTModule {
__render(fileData: Uint8Array, sampleRate: number): Int16Array;
Expand Down Expand Up @@ -120,7 +120,7 @@ class libopenmptHandler implements FormatHandler {
from: true,
to: false,
internal: fmt.ext,
category: "audio",
category: Category.AUDIO,
lossless: true
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/lzh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { FileData, FileFormat, FormatHandler } from "../FormatHandler.ts";
import { LZHDecoder } from "./lzh/decoder.ts";
import { LZHEncoder, type LHAFileInput } from "./lzh/encoder.ts";
import JSZip from "jszip";
import CommonFormats from "src/CommonFormats.ts";
import CommonFormats, { Category } from "src/CommonFormats.ts";
import normalizeMimeType from "../normalizeMimeType.ts";
import mime from "mime";

Expand All @@ -27,7 +27,7 @@ class LZHHandler implements FormatHandler {
from: true,
to: true,
internal: "lzh",
category: "archive",
category: Category.ARCHIVE,
lossless: true
},
CommonFormats.ZIP.builder("zip").allowFrom()
Expand Down
Loading
Loading