Protocol object is missing methods like registerBufferProtocol


From my main.js, I’m trying to register a protocol handler with the electron.protocol object. I am finding that the protocol object is missing all of the register methods such as registerBufferProtocol so all of the sample code in the docs fail for me as the methods on protocol object are undefined.

In main.js:

const electron = require(‘electron’)
const protocol = electron.protocol;

This yields

{ registerStandardSchemes: [Function],
getStandardSchemes: [Function] }

Where are all of the other functions like registerBufferProtocol?



I haven’t used any of those methods in my own projects, but I would say that if you’re seeing something clearly divergent from the documentation, you should screenshot the results and drop an issue in the Electron repo.



Note: All methods unless specified can only be used after the ready event of the app module gets emitted.

maybe you can try after app.on(‘ready’) get called?


Thanks for the suggestions. I get the same thing in after the app ready event:

app.on(‘ready’, function () {


{ registerStandardSchemes: [Function],
getStandardSchemes: [Function] }


right, the console.log will return same thing ( i have no idea on this as i did not dig in the detail), however, you should be able to call those functions now. previously you will get undefined instead.


Wow… you are correct. I could call registerBufferProtocol in the app ready handler. I’m baffled as to why console.log(electron.protocol) in the same place doesn’t have the function on it during its output. Maybe the object being logged is just thrown on a queue and the output of log happens later? Once the app ready handler exits maybe the methods are torn off the protocol object?
Anyway… thanks for help. I am unblocked.