diff --git a/src/core/file-types/index.ts b/src/core/file-types/index.ts index 0fb3926..b282651 100644 --- a/src/core/file-types/index.ts +++ b/src/core/file-types/index.ts @@ -82,6 +82,7 @@ export class FileTypes { static SQLITE: FileInfo = OtherTypes.SQLITE; static STL: FileInfo = OtherTypes.STL; static TTF: FileInfo = OtherTypes.TTF; + static DOC: FileInfo = OtherTypes.DOC; /** * Receive information on a file type by its property name from FileTypes class diff --git a/src/core/file-types/other.ts b/src/core/file-types/other.ts index 7157fbf..6e1b0ce 100644 --- a/src/core/file-types/other.ts +++ b/src/core/file-types/other.ts @@ -136,4 +136,16 @@ export class OtherTypes { }, ], }; + + static DOC: FileInfo = { + extension: "doc", + mimeType: "application/msword", + description: "Old microsoft Word documents", + signatures: [ + { + sequence: [0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1], + compatibleExtensions: ["xls", "ppt", "msi", "msg"], + }, + ], + }; } diff --git a/src/validation/other.ts b/src/validation/other.ts index d223b64..05f8cfc 100644 --- a/src/validation/other.ts +++ b/src/validation/other.ts @@ -140,3 +140,15 @@ export function isTTF(file: Array | ArrayBuffer | Uint8Array): boolean { const fileChunk: Array = getFileChunk(file); return FileTypes.checkByFileType(fileChunk, "ttf"); } + +/** + * Determine if file content contains a valid 'doc' file signature + * + * @param file File content represents in Array / ArrayBuffer / Uint8Array + * + * @returns {boolean} True if found a signature of type 'ttf' in file content, otherwise false + */ +export function isDOC(file: Array | ArrayBuffer | Uint8Array): boolean { + const fileChunk: Array = getFileChunk(file); + return FileTypes.checkByFileType(fileChunk, "doc"); +} \ No newline at end of file