Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

162
Visualizações
How to create a persistent on-disk session in ElectronJS?

How do I create a session which is persistent with on-disk storage so that I can load it even after the app quits? The Session class has a storagePath property which returns an absolute file system path for the session if it persists on disk, but this property is read-only.

I can't seem to find a way to set this path, the API reference doesn't contain any helpful methods.

So how do I make my session persist on disk?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The Session class has a storagePath property which returns an absolute file system path for the session if it persists on disk, but this property is read-only.

I can't seem to find a way to set this path, the API reference doesn't contain any helpful methods.

So how do I make my session persist on disk?

It's not very intuitive, but the ses.fromPartition API docs state:

If partition starts with persist:, the page will use a persistent session available to all pages in the app with the same partition. if there is no persist: prefix, the page will use an in-memory session. If the partition is empty then default session of the app will be returned.

For example:

const { session } = require('electron');

const ses = session.fromPartition('persist:my-partition');
console.log(ses.isPersistent()) // true 
console.log(ses.getStoragePath()) // /Users/user/Library/Application Support/app/Partitions/my-partition (on macOS)

Then the session partition path should be /USERDATA/Partitions/my-partition, where USERDATA is the value of app.getPath('userData').

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda