1

enter image description hereI want to create an image file named:

jszip.file('a/b.png', image) jszip.generateAsync({ type: 'blob' }).then(function (content) { saveAs(content, image + '.zip'); })

The results are equivalent: zip.folder('a').file('b.png', 'image') // equivalent

Is there a way to create an image with such a name, rather than splitting it into a directory??

VinhNguyen
  • 11
  • 2

2 Answers2

2

This isn't a limitation of code.. its limitation of filesystem... reference this StackOverflow question

Is it possible to use "/" in a filename?

DynasticSponge
  • 1,416
  • 2
  • 9
  • 13
0

I ran into this problem recently and on my MacOS machine I observed that it is possible to use slashes in filenames. I named a file with a slash and dragged and dropped it to the terminal and I saw that MacOS replaced the slash with a colon.

Since it appears you are using a MacOS machine, to get your desired output simply replace occurrences of the slash character with a colon.

jszip.file(filename.replace('/', ':'), image)
Zack Radisic
  • 21
  • 1
  • 1
  • 2