diff --git a/src/core/config/OperationConfig.js b/src/core/config/OperationConfig.js
index 43072558..d353328b 100755
--- a/src/core/config/OperationConfig.js
+++ b/src/core/config/OperationConfig.js
@@ -3261,14 +3261,14 @@ const OperationConfig = {
"Detect File Type": {
module: "Default",
description: "Attempts to guess the MIME (Multipurpose Internet Mail Extensions) type of the data based on 'magic bytes'.
Currently supports the following file types: 7z, amr, avi, bmp, bz2, class, cr2, crx, dex, dmg, doc, elf, eot, epub, exe, flac, flv, gif, gz, ico, iso, jpg, jxr, m4a, m4v, mid, mkv, mov, mp3, mp4, mpg, ogg, otf, pdf, png, ppt, ps, psd, rar, rtf, sqlite, swf, tar, tar.z, tif, ttf, utf8, vmdk, wav, webm, webp, wmv, woff, woff2, xls, xz, zip.",
- inputType: "byteArray",
+ inputType: "ArrayBuffer",
outputType: "string",
args: []
},
"Scan for Embedded Files": {
module: "Default",
description: "Scans the data for potential embedded files by looking for magic bytes at all offsets. This operation is prone to false positives.
WARNING: Files over about 100KB in size will take a VERY long time to process.",
- inputType: "byteArray",
+ inputType: "ArrayBuffer",
outputType: "string",
args: [
{
diff --git a/src/core/operations/FileType.js b/src/core/operations/FileType.js
index ad3e5ba7..715f8205 100755
--- a/src/core/operations/FileType.js
+++ b/src/core/operations/FileType.js
@@ -15,12 +15,13 @@ const FileType = {
/**
* Detect File Type operation.
*
- * @param {byteArray} input
+ * @param {ArrayBuffer} input
* @param {Object[]} args
* @returns {string}
*/
runDetect: function(input, args) {
- const type = FileType.magicType(input);
+ const data = new Uint8Array(input),
+ type = FileType.magicType(data);
if (!type) {
return "Unknown file type. Have you tried checking the entropy of this data to determine whether it might be encrypted or compressed?";
@@ -46,20 +47,21 @@ const FileType = {
/**
* Scan for Embedded Files operation.
*
- * @param {byteArray} input
+ * @param {ArrayBuffer} input
* @param {Object[]} args
* @returns {string}
*/
runScanForEmbeddedFiles: function(input, args) {
let output = "Scanning data for 'magic bytes' which may indicate embedded files. The following results may be false positives and should not be treat as reliable. Any suffiently long file is likely to contain these magic bytes coincidentally.\n",
type,
- ignoreCommon = args[0],
- commonExts = ["ico", "ttf", ""],
numFound = 0,
numCommonFound = 0;
+ const ignoreCommon = args[0],
+ commonExts = ["ico", "ttf", ""],
+ data = new Uint8Array(input);
- for (let i = 0; i < input.length; i++) {
- type = FileType.magicType(input.slice(i));
+ for (let i = 0; i < data.length; i++) {
+ type = FileType.magicType(data.slice(i));
if (type) {
if (ignoreCommon && commonExts.indexOf(type.ext) > -1) {
numCommonFound++;
@@ -96,7 +98,7 @@ const FileType = {
* Given a buffer, detects magic byte sequences at specific positions and returns the
* extension and mime type.
*
- * @param {byteArray} buf
+ * @param {Uint8Array} buf
* @returns {Object} type
* @returns {string} type.ext - File extension
* @returns {string} type.mime - Mime type