Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

342
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda