GW2DetermineFileTypeFromMemory
Tinutukoy ng function na GW2DetermineFileTypeFromMemory ang uri ng file ng file na ang nilalaman ay nasa buffer na hawak sa memory.
- C++
- C#
- Java
- Python
- JavaScript
Buod
#include "glasswall.core2.api.h"
ft_t GW2DetermineFileTypeFromFile(const char *inputFileBuffer, size_t inputLength);
Ibinabalik
Kung hindi matukoy ng GW2DetermineFileTypeFromMemory ang uri ng file, ibinabalik nito ang value ng enumeration constant na ft_unknown mula sa enumerated type na ft_t; kung hindi, ibinabalik nito ang isang value mula sa enumerated type na ft_t na nagsasaad ng uri ng file. Ang listahan ng mga enumeration constant ay nasa C source header file na filetype.h.
Buod
/// <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)
Ibinabalik
Isang value na nagsasaad ng natukoy na uri ng file - Ang listahan ng mga enumeration constant sa C source header file na filetype.h ay tumutugma sa ibinalik na value para sa function na ito.
Buod
import com.glasswall.core2javabridge.*;
public int GW2DetermineFileTypeFromMemory(byte[] fileBuffer) throws GlasswallException, NullPointerException
public int GW2DetermineFileTypeFromMemory(byte[] fileBuffer, int length) throws GlasswallException, NullPointerException
Tandaan
Ang length ng fileBuffer ay maaaring tukuyin bilang opsyonal.
Ibinabalik
Ang function na GW2DetermineFileTypeFromMemory ay nagbabalik ng isang enumerator na may type na ft_t na kino-convert sa isang int. Ang listahan ng mga enumeration constant ay makikita sa C source header file na filetype.h.
Magtatapon ng NullPointerException exception kung ang fileBuffer ay null o walang laman.
Magtatapon ng GlasswallException exception kung hindi makuha ang fileBuffer.
Buod
Tukuyin ang uri ng file ng ibinigay na input file, alinman bilang integer identifier o 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.
"""
Ibinabalik
Isang value o extension string na nagsasaad ng natukoy na uri ng file - Ang listahan ng mga enumeration constant ay nasa C source header file na filetype.h at tumutugma sa ibinalik na value para sa function na ito.
Buod
/**
* 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)
Ibinabalik
Isang halagang nagsasaad ng natukoy na uri ng file - Ang listahan ng mga enumeration constant ay nasa C source header file na filetype.h at tumutugma sa ibinalik na halaga para sa function na ito.