arraybuffer-loader

1.0.8 • Public • Published

ArrayBuffer loader for webpack

NPM

npm Travis Build status Dependency Status devDependency Status Maintainability Greenkeeper badge

Supported Platforms

  • Modern Browsers (IE >= 10)
  • Node.js

Getting Started

$ yarn add arraybuffer-loader

or

$ npm install arraybuffer-loader --save-dev

Usage

If you read only the specific extensions (e.g. wasm), please add loader in webpack.config.js.

module: {
  rules: [
    {
      test: /\.png$/,
      loaders: ['arraybuffer-loader'],
    },
  ],
},

Or if reading an arbitrary extension, use require.

const buffer = require('arraybuffer!./data.dat')
const array = new Uint8Array(buffer)

See also offical document Loaders.

For .wasm file

Webpack 4 or later has embedded WASM parser. So, please set type: 'javascript/auto' when use arraybuffer-loader.

module: {
  rules: [
    {
      test: /\.wasm$/,
      type: 'javascript/auto',
      loaders: ['arraybuffer-loader'],
    },
  ],
},

License

MIT © Pine Mizune

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.8
    8,333
    • latest

Version History

Package Sidebar

Install

npm i arraybuffer-loader

Weekly Downloads

9,134

Version

1.0.8

License

MIT

Unpacked Size

5.41 kB

Total Files

6

Last publish

Collaborators

  • pine613