filelist-utils
Advanced tools
Comparing version 1.7.1 to 1.8.0-pre.1682353626
@@ -20,6 +20,7 @@ import { fileCollectionItemsFromZip } from './fileCollectionFromZip'; | ||
} | ||
if (!(await isZip(file))) { | ||
const buffer = await file.arrayBuffer(); | ||
if (!isZip(buffer)) { | ||
continue; | ||
} | ||
const zipFileCollectionItems = await fileCollectionItemsFromZip(await file.arrayBuffer()); | ||
const zipFileCollectionItems = await fileCollectionItemsFromZip(buffer); | ||
for (let zipEntry of zipFileCollectionItems) { | ||
@@ -34,12 +35,13 @@ zipEntry.relativePath = `${file.relativePath}/${zipEntry.relativePath}`; | ||
} | ||
async function isZip(file) { | ||
const buffer = await file.arrayBuffer(); | ||
if (buffer.byteLength < 4) | ||
return false; | ||
const bytes = new Uint8Array(buffer); | ||
return (bytes[0] === 0x50 && | ||
bytes[1] === 0x4b && | ||
(bytes[2] === 0x03 || bytes[2] === 0x05 || bytes[2] === 0x07) && | ||
(bytes[3] === 0x04 || bytes[3] === 0x06 || bytes[3] === 0x08)); | ||
function isZip(buffer) { | ||
const isZip = !(buffer.byteLength < 4); | ||
if (!isZip) { | ||
const bytes = new Uint8Array(buffer); | ||
return (bytes[0] === 0x50 && | ||
bytes[1] === 0x4b && | ||
(bytes[2] === 0x03 || bytes[2] === 0x05 || bytes[2] === 0x07) && | ||
(bytes[3] === 0x04 || bytes[3] === 0x06 || bytes[3] === 0x08)); | ||
} | ||
return isZip; | ||
} | ||
//# sourceMappingURL=fileCollectionItemsUnzip.js.map |
@@ -23,6 +23,7 @@ "use strict"; | ||
} | ||
if (!(await isZip(file))) { | ||
const buffer = await file.arrayBuffer(); | ||
if (!isZip(buffer)) { | ||
continue; | ||
} | ||
const zipFileCollectionItems = await (0, fileCollectionFromZip_1.fileCollectionItemsFromZip)(await file.arrayBuffer()); | ||
const zipFileCollectionItems = await (0, fileCollectionFromZip_1.fileCollectionItemsFromZip)(buffer); | ||
for (let zipEntry of zipFileCollectionItems) { | ||
@@ -38,12 +39,13 @@ zipEntry.relativePath = `${file.relativePath}/${zipEntry.relativePath}`; | ||
exports.fileCollectionItemsUnzip = fileCollectionItemsUnzip; | ||
async function isZip(file) { | ||
const buffer = await file.arrayBuffer(); | ||
if (buffer.byteLength < 4) | ||
return false; | ||
const bytes = new Uint8Array(buffer); | ||
return (bytes[0] === 0x50 && | ||
bytes[1] === 0x4b && | ||
(bytes[2] === 0x03 || bytes[2] === 0x05 || bytes[2] === 0x07) && | ||
(bytes[3] === 0x04 || bytes[3] === 0x06 || bytes[3] === 0x08)); | ||
function isZip(buffer) { | ||
const isZip = !(buffer.byteLength < 4); | ||
if (!isZip) { | ||
const bytes = new Uint8Array(buffer); | ||
return (bytes[0] === 0x50 && | ||
bytes[1] === 0x4b && | ||
(bytes[2] === 0x03 || bytes[2] === 0x05 || bytes[2] === 0x07) && | ||
(bytes[3] === 0x04 || bytes[3] === 0x06 || bytes[3] === 0x08)); | ||
} | ||
return isZip; | ||
} | ||
//# sourceMappingURL=fileCollectionItemsUnzip.js.map |
{ | ||
"name": "filelist-utils", | ||
"version": "1.7.1", | ||
"version": "1.8.0-pre.1682353626", | ||
"description": "Create a FileCollection from a path or a zip file", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -34,8 +34,7 @@ import { FileCollectionItem } from './FileCollectionItem'; | ||
if (!(await isZip(file))) { | ||
const buffer = await file.arrayBuffer(); | ||
if (!isZip(buffer)) { | ||
continue; | ||
} | ||
const zipFileCollectionItems = await fileCollectionItemsFromZip( | ||
await file.arrayBuffer(), | ||
); | ||
const zipFileCollectionItems = await fileCollectionItemsFromZip(buffer); | ||
@@ -55,13 +54,14 @@ for (let zipEntry of zipFileCollectionItems) { | ||
async function isZip(file: FileCollectionItem) { | ||
const buffer = await file.arrayBuffer(); | ||
if (buffer.byteLength < 4) return false; | ||
const bytes = new Uint8Array(buffer); | ||
return ( | ||
bytes[0] === 0x50 && | ||
bytes[1] === 0x4b && | ||
(bytes[2] === 0x03 || bytes[2] === 0x05 || bytes[2] === 0x07) && | ||
(bytes[3] === 0x04 || bytes[3] === 0x06 || bytes[3] === 0x08) | ||
); | ||
function isZip(buffer: ArrayBuffer) { | ||
const isZip = !(buffer.byteLength < 4); | ||
if (!isZip) { | ||
const bytes = new Uint8Array(buffer); | ||
return ( | ||
bytes[0] === 0x50 && | ||
bytes[1] === 0x4b && | ||
(bytes[2] === 0x03 || bytes[2] === 0x05 || bytes[2] === 0x07) && | ||
(bytes[3] === 0x04 || bytes[3] === 0x06 || bytes[3] === 0x08) | ||
); | ||
} | ||
return isZip; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
159243
2490
1