Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

filelist-utils

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filelist-utils - npm Package Compare versions

Comparing version 1.7.1 to 1.8.0-pre.1682353626

24

lib-esm/fileCollectionItemsUnzip.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc