Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

343
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!