# gulp-dataurl

> A gulp plugin that converts matched file paths into base64-encoded data URI strings.

Latest version **1.2.1** (published 2023-12-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-dataurl
pnpm add gulp-dataurl
yarn add gulp-dataurl
bun add gulp-dataurl
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2023-12-27 |
| First published | 2023-12-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 9.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Mervin |
| Maintainers | mengqing723 |
| Keywords | gulp plugin, gulp-base64, data URI, base64, dataurl |

## Links

- npm: https://www.npmjs.com/package/gulp-dataurl
- Repository: https://github.com/meqn/gulp-dataurl
- Homepage: https://github.com/meqn/gulp-dataurl#readme
- Issues: https://github.com/meqn/gulp-dataurl/issues
- npm.io page: https://npm.io/package/gulp-dataurl

## Dependencies (5)

- [mime](https://npm.io/package/mime.md) ^3.0.0
- [diy-log](https://npm.io/package/diy-log.md) ^2.5.1
- [through2](https://npm.io/package/through2.md) ^4.0.2
- [@types/node](https://npm.io/package/@types/node.md) *
- [file-access](https://npm.io/package/file-access.md) ^1.1.2

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.2.1 (latest) — 2023-12-27
- 1.2.0 — 2023-12-20
- 1.1.0 — 2023-12-14
- 1.0.1 — 2023-12-14
- 1.0.0 — 2023-12-14

## README

# gulp-dataurl

[![version](https://img.shields.io/npm/v/gulp-dataurl?style=flat-square)](https://www.npmjs.com/package/gulp-dataurl)
[![Codecov](https://img.shields.io/codecov/c/github/meqn/gulp-dataurl?token=UP2HP31ILF&style=flat-square&logo=codecov)](https://codecov.io/gh/Meqn/gulp-dataurl)
[![release](https://img.shields.io/github/actions/workflow/status/meqn/gulp-dataurl/release.yml?style=flat-square)](https://github.com/Meqn/pipflow/releases)



> A gulp plugin that converts matched file paths into base64-encoded data URI strings.

一个 gulp 插件，用于将匹配到的文件路径转换为 `base64` 编码的 data URI 字符串。



## features

- ☁️ Support for remote files
- 🪝 Customizable file type extensions
- 🚦 Inclusion/exclusion rulesets for selective file encoding
- 🚧 File size limits to prevent overly large Data URLs
- 🚀 Cache duplicate processed files



## Usage

Install with npm
```bash
npm install -D gulp-dataurl
```

gulp task:
```js
const gulp = require('gulp');
const dataurl = require('gulp-dataurl');

gulp.task('html', function() {
  return gulp.src('src/**/*.html')
    .pipe(dataurl({
      remote: true,
      extensions: ['.png', '.gif', '.svg'],
      include: /\?inline$/i,
      exclude: 'node_modules',
      limit: 2048 //2kb
    }))
    .pipe(gulp.dest('dist')); 
});
```



## Options


#### remote
- Type: `boolean`
- Default: `false`

Whether remote files are supported.

#### extensions
- Type: `string | string[]`

Supported extensions.

#### include
- Type: `string | string[] | RegExp | RegExp[]`

Matching rule patterns.

#### exclude
- Type: `string | string[] | RegExp | RegExp[]`

Exclusion rule patterns.


#### limit
- Type: `number`
- Default: `4096`

File Size Limit.

---
_Source: https://npm.io/package/gulp-dataurl · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
