Detect File Format of Encrypted Office Open XML - OOXML Files with Node.js via C++

Contents
[ ]

Aspose.Cells provides a way to detect the file format of encrypted Microsoft Open XML files. To identify the file type, use the FileFormatUtil.detectFileFormat(Uint8Array) method as shown below in the code example.

const fs = require("fs");
const path = require("path");
const AsposeCells = require("aspose.cells.node");

// Source directory
const sourceDir = path.join(__dirname, "data");
const filePath = path.join(sourceDir, "encryptedBook1.out.tmp");

fs.writeFileSync(filePath, Buffer.from([0x50, 0x4B, 0x03, 0x04]));
const stream = fs.readFileSync(filePath);
AsposeCells.FileFormatUtil.verifyPassword(stream, "1234");
const fileFormatInfo = AsposeCells.FileFormatUtil.detectFileFormat(stream);

console.log("File Format: " + fileFormatInfo.getFileFormatType());