I would like to read inside zip archives with Electron as if they were folders, like so /myfolder/myarchive.zip/picture.jpg
. To do this I'm thinking about intercepting the file protocol
protocol.interceptFileProtocol('file', (request, callback) => {
if (insideZipArchive) {
//respond with zip file contents
} else {
//defaultBehavior
}
}, (error) => {
if (error) console.error('Failed to register protocol')
})
How do I invoke the default behavior? Also doing an AJAX request inside the interceptor and serving files like this callback({data: new Buffer(xhr.responseText)})
does not seem to work.