Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pine/arraybuffer-loader
:dvd: ArrayBuffer loader for webpack
https://github.com/pine/arraybuffer-loader
javascript nodejs webpack
Last synced: 10 days ago
JSON representation
:dvd: ArrayBuffer loader for webpack
- Host: GitHub
- URL: https://github.com/pine/arraybuffer-loader
- Owner: pine
- License: mit
- Created: 2016-07-26T15:43:53.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2023-02-16T19:53:13.000Z (over 1 year ago)
- Last Synced: 2024-05-29T16:56:55.438Z (5 months ago)
- Topics: javascript, nodejs, webpack
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/arraybuffer-loader
- Size: 83 KB
- Stars: 45
- Watchers: 2
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# arraybuffer-loader [![npm](https://img.shields.io/npm/v/arraybuffer-loader.svg?maxAge=2592000)](https://www.npmjs.org/package/arraybuffer-loader) [![build](https://github.com/pine/arraybuffer-loader/actions/workflows/build.yml/badge.svg)](https://github.com/pine/arraybuffer-loader/actions/workflows/build.yml) [![License](https://img.shields.io/github/license/emoji-gen/clone-into.svg)](LICENSE)
:dvd: ArrayBuffer loader for webpack
## 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`.```js
module: {
rules: [
{
test: /\.png$/,
loaders: ['arraybuffer-loader'],
},
],
},
```Or if reading an arbitrary extension, use `require`.
```js
const buffer = require('arraybuffer!./data.dat')
const array = new Uint8Array(buffer)
```See also offical document [Loaders](https://webpack.js.org/concepts/loaders/).
### For `.wasm` file
Webpack 4 or later has embedded WASM parser. So, please set `type: 'javascript/auto'` when use `arraybuffer-loader`.```js
module: {
rules: [
{
test: /\.wasm$/,
type: 'javascript/auto',
loaders: ['arraybuffer-loader'],
},
],
},
```## License
MIT © [Pine Mizune](https://profile.pine.moe)