Coder Social home page Coder Social logo

gulp-to-base64's Introduction

gulp-to-base64 npm

A simple gulp plugin, used to convert image(png|jpg|gif),audio(mp3|m4a|ogg|wav|wma),video(mp4|webm), font(ttf|svg) into base64 string.

Install

npm install gulp-to-base64

Usage

    var gulpBase64 = require("gulp-to-base64");
    gulpBase64(options);

Example

    var gulpBase64 = require("gulp-to-base64");
    gulp.task('base64' , function(){
      return gulp.src("./images/*.{png,jpg,jpeg,mp3,svg,ttf}")
		.pipe(gulpBase64({
			size: true  // false by default  , if true , write the width height
			outPath:"./json.js"  //output file path
		}))
    });

Generate Structures

If size is false

	{
		file name : base64 encode
	}

to true

	{
		file name : {base64: base64 encode, width: xx, height: xx}, //image
		file name : {base64: base64 encode}  //xx.ttf,xx.svg,mp3,mp4  
	}

Interface Options

outPath is file path.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.