node-archiver icon indicating copy to clipboard operation
node-archiver copied to clipboard

How to get a blob out of archiverjs?

Open noomly opened this issue 6 years ago • 0 comments

Hello,

Sorry if I'm misunderstanding things, I'm not usually working with web technologies. I should note that I'm working only client-side using typescript and webpack, no nodejs.

So I have a canvas on which I draw. I want to be able to record what's happening on the canvas at certain moments. I have tried using CCapture.js but for some reason it doesn't work with typescript&webpack and the author didn't bother to fix it. As a consequence my strategy is now to capture the images myself with this kind of pipeline:

  • Capture several snapshots in form of Blobs (with canvas.toBlob)
  • When I have enough of them, archive them together with archiverjs
  • Save the archive to the user

Right now I believe I am able to create the archive but being on the client-side I don't know what to do next. I don't really know how to use WriteableStreams and it seems more difficult on the client-side than on nodejs as I can't simply write to the user's filesystem.

Is there a way to convert the archive to a Blob and then be able to save it locally? Is there another way if this isn't possible?

Thanks

noomly avatar Dec 24 '19 00:12 noomly