Stuk / jszip

Create, read and edit .zip files with Javascript
https://stuk.github.io/jszip/
Other
9.75k stars 1.3k forks source link

Is jszip unmaintained? #915

Open gruenich opened 8 months ago

gruenich commented 8 months ago

Is jszip unmaintained? No release or commit since August of 2022. There are plenty of merge requests and issues.

I am not judging, I wanted to know the status. Maybe some backgrounds like: Lack of interest? Lack of money? Would someone be interested in taking over this project?

kibertoad commented 8 months ago

I would be open to co-maintaing the library. @Stuk - would you be open to that?

numericOverflow commented 5 months ago

Tagging along for the answer.

Again, @Stuk it's an awesome util, just want to know current state for planning choices!

unilynx commented 5 months ago

Same question. Also I'm considering whether it would be worth forking jszip to remove pako as a dependency, as nodejs comes with zlib.

(and even browsers seem to have (de)compression support now - https://developer.mozilla.org/en-US/docs/Web/API/Compression_Streams_API - although I'm personally only interested in the serverside use case now)

offaxis commented 4 months ago

Great work ! But is it still maintained ? What are the alternatives ?

unilynx commented 4 months ago

Great work ! But is it still maintained ? What are the alternatives ?

For nodejs, https://www.npmjs.com/package/node-stream-zip is an alternative for decompressing - I've just successfully integrated it. You can pass a file path to it which reduces the memory requirements - in nodejs, jszip wants the file to be decompressed in a Buffer, which is not an option for me with multi-GB zip files

Neither supports nodejs's Blobs unfortunately - jszip seems to have some support for Blobs but only in its browser supporting parts, not in the nodejs parts. (I checked if there was quick fix for that, but jszip relies on FileReader to read Blobs which isn't available in Node 20)

offaxis commented 4 months ago

Thanks for your reply, but my needs is essentially for creating a zip archive.

lpatiny commented 4 months ago

I did some tests with https://gildas-lormeau.github.io/zip.js/ and it seems pretty convincing. I was able to compress much faster that with jszip (factor 3 on my macbook air). Also it should be able to deal with Zip64 files (yes I have a zip of 29Gb ...) but I didn't try yet.

unilynx commented 4 months ago

@lpatiny nice find. zip.js wasn't on my shortlist yet. It seems to tick all the boxes...

This library works fully with the latest versions of Chrome, Firefox, Safari, Microsoft Edge, and Deno.

interestingly no mention of nodejs, but that's probably considered t one implicit, https://github.com/gildas-lormeau/zip.js/blob/master/package.json shows support for nodejs >= 16.5

factor 3 on my macbook air

yeah I was hoping for such numbers when not having to deal with a WASM version of zlib

lpatiny commented 4 months ago

I tested it with nodeJS (type=module). Not sure the best way to use this library.

import { readdir, readFile } from 'fs/promises'
import { writeFileSync } from 'fs'
import { join } from 'path'

import { BlobWriter, Uint8ArrayReader, ZipWriter } from '@zip.js/zip.js'

const source = 'node_modules'
const lastPart = source.split('/').pop();

const files = (await readdir(new URL(source, import.meta.url), { recursive: true, withFileTypes: true })).filter(entry => entry.isFile());

// Creates a BlobWriter object where the zip content will be written.
const blobWriter = new BlobWriter();
const zipWriter = new ZipWriter(blobWriter);

const promises = [];
const pathReplacer = new RegExp(".*/" + lastPart);
for (const file of files) {
  const currentDir = file.path.replace(pathReplacer, '');
  const path = currentDir + (currentDir ? '/' : '') + file.name;
  promises.push(
    (async () => {
      const data = await readFile(join(file.path, file.name))
      const unit8ArrayReader = new Uint8ArrayReader(data);
      await zipWriter.add(path, unit8ArrayReader);
    })()
  );
}

await Promise.all(promises);
await zipWriter.close();
const zipFileBlob = await blobWriter.getData();
const array = new Uint8Array(await zipFileBlob.arrayBuffer());
writeFileSync(new URL('zipjs.zip', import.meta.url), array);