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

345
Visualizações
Load binary file into an ArrayBuffer using webpack

In the browser, I am trying to load a binary file (loaded using webpack, not via HTTP call) into an ArrayBuffer (which will then be parsed using TypedArrays). I am trying to use webpack asset Modules to pack the binary file with the rest of the browser files, but I haven't found a way to extract that file inside the browser code and construct an ArrayBuffer from it.

I am specifying the packing as follows:

module.exports = {
    publicPath: '/some/path/',
    configureWebpack: {
      module: {
        rules: [
          {
            test: /\.trie$/,
            type: 'asset/inline',
              generator: {
                dataUrl: content => content
            }
          },
        ],
      },
    }
  }

and then in my typescript file I am 'loading' the content:

 const content = require('./50k.trie');

The Chrome debugger tells me that content is of type 'Buffer' (I thought that as a Node.js data type, not a browser data type):

enter image description here

but from here I haven't found a way to construct/load/create an ArrayBuffer.

Do I need to use a different asset type?

about 4 years ago · Juan Pablo Isaza
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