Обнаружение формата файла зашифрованных офисных XML файлов — OOXML с помощью Node.js через C++

Contents
[ ]

Aspose.Cells предоставляет способ обнаружения формата файла зашифрованных Microsoft Open XML файлов. Для определения типа файла используйте метод FileFormatUtil.detectFileFormat(Uint8Array), как показано в примере кода.

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());