{"id":19393,"library":"buffer-loader","title":"buffer-loader","description":"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.","status":"maintenance","version":"0.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/xicombd/buffer-loader","tags":["javascript"],"install":[{"cmd":"npm install buffer-loader","lang":"bash","label":"npm"},{"cmd":"yarn add buffer-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add buffer-loader","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Webpack loaders are typically used with CommonJS require. ESM import may not work depending on webpack configuration.","wrong":"import content from 'buffer-loader!./file.bin';","symbol":"default","correct":"const content = require('buffer-loader!./file.bin');"}],"quickstart":{"code":"// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.bin$/,\n        use: 'buffer-loader'\n      }\n    ]\n  }\n};\n\n// In a module\nconst fileContent = require('buffer-loader!./file.bin');\nconsole.log(fileContent); // <Buffer ...>\n","lang":"javascript","description":"Configures webpack to use buffer-loader for .bin files, then imports a binary file as a Buffer."},"warnings":[{"fix":"Use const content = require('buffer-loader!./file.bin'); instead of import.","message":"buffer-loader is not compatible with ESM imports directly; use CommonJS require with the loader prefix.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider using raw-loader for newer webpack versions: { test: /\\.bin$/, use: 'raw-loader' }.","message":"buffer-loader may not work with webpack 4+ if not configured properly; it is an older loader.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install buffer-loader --save-dev","cause":"buffer-loader is not installed or not in node_modules.","error":"Module not found: Error: Can't resolve 'buffer-loader'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}