Registry / web-framework / buffer-loader

buffer-loader

JSON →
library0.1.0jsnpmunverified

A webpack loader that returns the content of a file as a Node.js Buffer. This package is at version 0.1.0, compatible with Node >=5.10 and webpack. It is adapted from binary-loader and provides a simple way to import binary files as Buffer objects in webpack bundles. It does not appear to have been updated since its initial release, and it is not widely used. Alternative loaders like raw-loader or file-loader may be more modern and maintained. It only works with CommonJS imports and is not compatible with ESM.

npm install buffer-loader
INSTALL
IMPORT
SIG · BUFFER-LOADER
B
buffer-loader
web-frameworkjavascriptv0.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const content = require('buffer-loader!./file.bin');
import content from 'buffer-loader!./file.bin';
Webpack loaders are typically used with CommonJS require. ESM import may not work depending on webpack configuration.

Configures webpack to use buffer-loader for .bin files, then imports a binary file as a Buffer.

// webpack.config.js module.exports = { module: { rules: [ { test: /\.bin$/, use: 'buffer-loader' } ] } }; // In a module const fileContent = require('buffer-loader!./file.bin'); console.log(fileContent); // <Buffer ...>
Debug
Known issues
gotchabuffer-loader is not compatible with ESM imports directly; use CommonJS require with the loader prefix.
fix
Use const content = require('buffer-loader!./file.bin'); instead of import.
affects: >=0.0.0
gotchabuffer-loader may not work with webpack 4+ if not configured properly; it is an older loader.
fix
Consider using raw-loader for newer webpack versions: { test: /\.bin$/, use: 'raw-loader' }.
affects: >=0.0.0
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'buffer-loader'
buffer-loader is not installed or not in node_modules.
fix
Run npm install buffer-loader --save-dev
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
8
OpenAI (training)
1
Resources
buffer-loader — npm install buffer-loader · libregistry