Skip to content

How can I get the blob url when I finished zip #277

Answered by hugetiny
hugetiny asked this question in Q&A
Discussion options

You must be logged in to vote

I want to select a file, zip it ,and upload to server.
The code is like :

const inputBlob = "blob:http......."
const blobWriter = new zip.BlobWriter("application/zip");
const zipWriter = new zip.ZipWriter(blobWriter, {level: 9});
const r = await zipWriter.add(fileName, new zip.BlobReader(inputBlob));
//const result = await zipWriter.close()
const blob = await blobWriter.getData()
const blobURL = URL.createObjectURL(blob)
window.open(blobURL, "_blank");

And finally I got the file 1kb ~ 2kb that can't be read

Replies: 2 comments 11 replies

Comment options

You must be logged in to vote
6 replies
@gildas-lormeau
Comment options

@hugetiny
Comment options

@gildas-lormeau
Comment options

@hugetiny
Comment options

@gildas-lormeau
Comment options

Comment options

You must be logged in to vote
5 replies
@gildas-lormeau
Comment options

@hugetiny
Comment options

@gildas-lormeau
Comment options

@hugetiny
Comment options

@gildas-lormeau
Comment options

Answer selected by hugetiny
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #276 on September 21, 2021 19:46.