GW2DetermineFileTypeFromMemory
GW2DetermineFileTypeFromMemory function उस file का file type निर्धारित करता है जिसकी content memory में रखे गए buffer में होती है.
- C++
- C#
- Java
- Python
- JavaScript
सारांश
#include "glasswall.core2.api.h"
ft_t GW2DetermineFileTypeFromFile(const char *inputFileBuffer, size_t inputLength);
रिटर्न
यदि GW2DetermineFileTypeFromMemory file type को पहचान नहीं पाता, तो यह enumerated type ft_t से enumeration constant ft_unknown का value लौटाता है; अन्यथा, यह file type को दर्शाने वाला enumerated type ft_t का एक value लौटाता है. enumeration constants की सूची C source header file filetype.h में है.
सारांश
/// <summary>
/// Returns a value indicating the the file type from an input file by Glasswall.
/// </summary>
/// <param name="inputFileBuffer">The input buffer containing the file to be determined</param>
/// <returns>A value indicating the determined file type</returns>s
public int DetermineFileTypeFromMemory(byte[] inputFileBuffer)
रिटर्न
निर्धारित file type को दर्शाने वाला एक value - enumeration constants की सूची C source header file filetype.h में है और इस function द्वारा लौटाए गए value के अनुरूप है.
सारांश
import com.glasswall.core2javabridge.*;
public int GW2DetermineFileTypeFromMemory(byte[] fileBuffer) throws GlasswallException, NullPointerException
public int GW2DetermineFileTypeFromMemory(byte[] fileBuffer, int length) throws GlasswallException, NullPointerException
नोट
The length of the fileBuffer may optionally be specified.
रिटर्न
GW2DetermineFileTypeFromMemory function ft_t type के एक enumerator को int में convert करके लौटाता है. enumeration constants की सूची C source header file filetype.h में मिल सकती है.
A NullPointerException exception will be thrown if fileBuffer is null or empty.
A GlasswallException exception will be thrown if fileBuffer cannot be retrieved.
सारांश
दिए गए इनपुट फ़ाइल का फ़ाइल प्रकार निर्धारित करें, या तो एक integer identifier के रूप में या एक string के रूप में।
def determine_file_type(self, input_file: Union[str, bytes, bytearray, io.BytesIO], as_string: bool = False, raise_unsupported: bool = True) -> Union[int, str]:
""" Determine the file type of a given input file, either as an integer identifier or a string.
Args:
input_file (Union[str, bytes, bytearray, io.BytesIO]): The input file to analyse. It can be provided as a file path (str), bytes, bytearray, or a BytesIO object.
as_string (bool, optional): Return file type as string, eg: "bmp" instead of: 29. Defaults to False.
raise_unsupported (bool, optional): Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
file_type (Union[int, str]): The file type.
"""
रिटर्न
निर्धारित file type को दर्शाने वाला एक value या extension string - enumeration constants की सूची C source header file filetype.h में है और इस function द्वारा लौटाए गए value के अनुरूप है.
सारांश
/**
* This function determines the file type for a given file provided it is supported by Glasswall. Notice this is not related to a session.
* @param {string} path The path to the provided file.
* @returns {number} The determined file type, as enumerated in the C source header file filetype.h.
*/
GW2DetermineFileTypeFromMemory(inputFileBuffer, inputLength)
रिटर्न
निर्धारित फ़ाइल प्रकार दर्शाने वाला एक मान - enumeration constants की एक सूची C source header file filetype.h में है, जो इस function के लौटाए गए मान के अनुरूप है।