FileFormatUtil

FileFormatUtil class

Provides utility methods for converting file format enums to strings or file extensions and back.

new FileFormatUtil()

Methods

NameDescription
detectFileFormat(stream) (static)Detects and returns the information about a format of a visio stored in a stream.
detectFileFormat(filePath) (static)Detects and returns the information about a format of a visio stored in a file.
detectFileFormatFromStream(stream, callback) (static)Detects and returns the information about a format of a visio stored in a stream.

detectFileFormat(stream) (static)

Detects and returns the information about a format of a visio stored in a stream.

ParameterTypeDescription
streamInputStreamThe stream

Returns: FileFormatInfo — FileFormatInfo A FileFormatInfo object that contains the detected information.

detectFileFormat(filePath) (static)

Detects and returns the information about a format of a visio stored in a file.

ParameterTypeDescription
filePathStringThe file path.

Returns: FileFormatInfo — FileFormatInfo A FileFormatInfo object that contains the detected information.

Example:

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
info = aspose.diagram.FileFormatUtil.detectFileFormat("example.vsdx");
console.log("detect result: " + info.getFileFormatType());

detectFileFormatFromStream(stream, callback) (static)

Detects and returns the information about a format of a visio stored in a stream.

ParameterTypeDescription
streamReadableStreamThe stream
callbackCallbackThe callback function

Returns: FileFormatInfo — FileFormatInfo A FileFormatInfo object that contains the detected information.

Example:

var aspose = aspose || {};
aspose.diagram = require("aspose.diagram");
var fs = require("fs");
var readStream = fs.createReadStream("example.vsdx");
aspose.diagram.FileFormatUtil.detectFileFormatFromStream(readStream, function(result, err) {
if (!err) {
console.log("detect result: " + result.getFileFormatType());
}
});