lib/file_type.js
function findNextZipHeaderIndex(arr) {
			var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
			return arr.findIndex(function (el, i, arr) {
				return i >= startAt && arr[i] === 0x50 && arr[i + 1] === 0x4B && arr[i + 2] === 0x3 && arr[i + 3] === 0x4;
			});
		}
function findNextZipHeaderIndex(arr) {
			var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
			return arr.findIndex(function (el, i, arr) {
				return i >= startAt && arr[i] === 0x50 && arr[i + 1] === 0x4B && arr[i + 2] === 0x3 && arr[i + 3] === 0x4;
			});
		}
function findNextZipHeaderIndex ( arr ) { var startAt = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : 0 ; return arr . findIndex ( function ( el , i , arr ) { return i >= startAt && arr [ i ] === 0x50 && arr [ i + 1 ] === 0x4B && arr [ i + 2 ] === 0x3 && arr [ i + 3 ] === 0x4 ; } ) ; }
The docx, xlsx and pptx file types extend the Office Open XML file format: https://en.wikipedia.org/wiki/Office_Open_XML_file_formats We look for: - one entry named '[Content_Types].xml' or '_rels/.rels', - one entry indicating specific type of file. MS Office, OpenOffice and LibreOffice may put the parts in different order, so the check should not rely on it.
The docx xlsx and pptx file types extend the Office Open XML file format : https : // en . wikipedia . org / wiki / Office_Open_XML_file_formats We look for : - one entry named [ Content_Types ] . xml or _rels / . rels - one entry indicating specific type of file . MS Office OpenOffice and LibreOffice may put the parts in different order so the check should not rely on it .