Skip to content

Iterate files in an archive is harder than it should #12

@Sturez

Description

@Sturez

Imagine the situation where we have no clue of which files we should get (so no possibility archive.get('filename') ). it would be natural trying to use the Iterator archive.files(). but here the thing:

` const archive = await ZipArchive.from_blob(blob)

  let currentFile = archive.files().next()
  while (!currentFile.done) {
    const [fileName, zipEntry] = currentFile.value
    console.log(fileName, zipEntry)
    currentFile = archive.files().next()
  }

`
the iterator does not move ahead.

for (const iterator of archive.files()) { .... }

Type 'Iterator<[string, ZipEntry], any, undefined>' must have a 'Symbol.iterator' method that returns an iterator.

if I am missing other ways to deal with that, just let me know.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions