Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ZIP64 Support to zip-stream.js #259

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
StreamSaver.js (legacy-ish)
StreamSaver.js (legacy-ish) - with ZIP64 support
===========================

... Don't worry it's not deprecated. It's still maintained and i still recommend
Expand Down
22 changes: 13 additions & 9 deletions examples/saving-multiple-files.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
<script src="zip-stream.js"></script>
<script>
$start.onclick = () => {
files = []
const fileStream = streamSaver.createWriteStream('archive.zip')

const file1 = new File(['file1 content'], 'streamsaver-zip-example/file1.txt')

files.push(file1)
// File Like object works too
const file2 = {
name: 'streamsaver-zip-example/file2.txt',
Expand All @@ -41,14 +42,18 @@
})
}
}
files.push(file2)

const blob = new Blob(['support blobs too'])
const blob = new Blob(['x'.repeat(1024)])

const file3 = {
name: 'streamsaver-zip-example/blob-example.txt',
stream: () => blob.stream()
}

files.push(file3)


// In a ideall world i would just have used a TransformStream
// where you would get `{ readable writable } = new TransformStream()`
// `readable` would be piped to streamsaver, and the writer would accept
Expand All @@ -64,24 +69,23 @@
// windows gets confused when file & folders starts with /
const readableZipStream = new ZIP({
start (ctrl) {
ctrl.enqueue(file1)
ctrl.enqueue(file2)
ctrl.enqueue(file3)
files.forEach(f => {ctrl.enqueue(f)})
ctrl.enqueue({name: 'streamsaver-zip-example/empty folder', directory: true})
// ctrl.close()
},
}
/*
async pull (ctrl) {
// Gets executed everytime zip.js asks for more data
const url = 'https://d8d913s460fub.cloudfront.net/videoserver/cat-test-video-320x240.mp4'
const url = 'https://download.blender.org/durian/movies/Sintel.2010.4k.mkv'
const res = await fetch(url)
const stream = () => res.body
const name = 'streamsaver-zip-example/cat.mp4'
const name = 'streamsaver-zip-example/sintel.mkv'

ctrl.enqueue({ name, stream })

// if (done adding all files)
ctrl.close()
}
}*/
})

// more optimized
Expand Down
Loading