Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

binary-base64-loader

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

binary-base64-loader - npm Package Compare versions

Comparing version 0.0.1-security to 1.0.0

dist/index.js

52

package.json
{
"name": "binary-base64-loader",
"version": "0.0.1-security",
"description": "security holding package",
"repository": "npm/security-holder",
"dependencies": {}
"version": "1.0.0",
"description": "A loader for webpack that allows importing binary files as a String",
"license": "MIT",
"repository": "github:krakoi/binary-base64-loader",
"author": "Gyula Kisrákói",
"homepage": "https://github.com/krakoi/binary-base64-loader",
"bugs": "https://github.com/krakoi/binary-base64-loader/issues",
"main": "dist/index.js",
"engines": {
"node": ">=10.13.0"
},
"scripts": {
"build": "babel src --out-dir dist --copy-files",
"security": "npm audit",
"autoformat": "prettier --write .",
"lint:prettier": "prettier --check .",
"lint:js": "eslint --cache .",
"lint": "npm run lint:js && npm run lint:prettier",
"check-published": "npm publish --dry-run"
},
"files": [
"dist"
],
"peerDependencies": {
"webpack": "^4.0.0 || ^5.0.0"
},
"keywords": [
"webpack",
"webpack-loader",
"base64"
],
"dependencies": {
"loader-utils": "^2.0.0",
"schema-utils": "^2.7.0"
},
"devDependencies": {
"@babel/cli": "^7.10.5",
"@babel/core": "^7.11.4",
"@babel/preset-env": "^7.11.0",
"@webpack-contrib/defaults": "^6.3.0",
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
"eslint": "^7.7.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-prettier": "^3.1.4",
"prettier": "^2.0.5",
"webpack": "^4.44.1"
}
}

@@ -1,9 +0,106 @@

# Security holding package
<div align="center">
<img width="150" height="200"
src="https://www.iconfinder.com/icons/298769/download/svg/512">
<a href="https://github.com/webpack/webpack">
<img width="200" height="200"
src="https://webpack.js.org/assets/icon-square-big.svg">
</a>
</div>
This package name is not currently in use, but was formerly occupied
by another package. To avoid malicious use, npm is hanging on to the
package name, but loosely, and we'll probably give it to you if you
want it.
# binary-base64-loader
You may adopt this package by contacting support@npmjs.com and
requesting the name.
A webpack loader that allows loading binary files as Base64 encoded strings.
Based on https://github.com/webpack-contrib/raw-loader
## Getting Started
Install `binary-base64-loader`:
```console
$ npm install binary-base64-loader --save-dev
```
After that you can load files with specific extensions using webpack config as usual, for example:
**webpack.config.js**
```js
// webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.bin$/i,
use: 'binary-base64-loader',
},
],
},
};
```
Then you can import the content of binary files with the given extension as Base64 encoded strings:
```js
import bigAsset from './asset.bin';
// bigAsset will equal to 'WW91IGp1c3QgbG9zdCBUSEUgR0FNRSE=...
```
Most probably though you will want to use the loader inline, without registering specific extensions in the webpack config. For example:
```js
import fontBinary from '!!binary-base64-loader!./funkyicons.ttf';
```
(The `!!` prefix is not obligatory but probably you will need it to remove other loaders from the chain which could apply based on the webpack config)
To make the inline use work under Typescript add this to a Typescript definition file in your project (`*.d.ts`, for example `shims-vue.d.ts`):
```typescript
declare module "!!binary-base64-loader!*" {
const content: string;
export default content;
}
```
## Options
| Name | Type | Default | Description |
| :-------------------------: | :---------: | :-----: | :--------------------- |
| **[`esModule`](#esmodule)** | `{Boolean}` | `true` | Uses ES modules syntax |
### `esModule`
Type: `Boolean`
Default: `true`
By default, `binary-base64-loader` generates JS modules that use the ES modules syntax.
There are some cases in which using ES modules is beneficial, like in the case of [module concatenation](https://webpack.js.org/plugins/module-concatenation-plugin/) and [tree shaking](https://webpack.js.org/guides/tree-shaking/).
You can enable a CommonJS module syntax using:
**webpack.config.js**
```js
module.exports = {
module: {
rules: [
{
test: /\.bin$/i,
use: [
{
loader: 'binary-base64-loader',
options: {
esModule: false,
},
},
],
},
],
},
};
```
## License
[MIT](./LICENSE)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc