Skip to content

Instantly share code, notes, and snippets.

View Sveagruva's full-sized avatar

Sveagruva Sveagruva

View GitHub Profile
@Sveagruva
Sveagruva / stream_content_electron
Created February 5, 2022 18:59
stream content asynchronously in your electron app without http server. stream html as you build it.
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