Skip to content

Instantly share code, notes, and snippets.

Avatar

Sveagruva Sveagruva

View GitHub Profile
@Sveagruva
Sveagruva / stream_content_electron
Created Feb 5, 2022
stream content asynchronously in your electron app without http server. stream html as you build it.
View stream_content_electron
const electron = require('electron');
const PassThrough = require('stream').PassThrough;
// why. idk
electron.app.whenReady().then(() => {
electron.protocol.interceptStreamProtocol('file', async (req, callback) => {
const stream = new PassThrough();
callback({
data: stream