All Projects → scriptex → svg64

scriptex / svg64

Licence: MIT license
Convert SVG to base64 in Node and the browser

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to svg64

Easycaptcha
Java图形验证码,支持gif、中文、算术等类型,可用于Java Web、JavaSE等项目。
Stars: ✭ 1,084 (+4416.67%)
Mutual labels:  base64
Easycv
easyCV (video recorder and snapshot library,based on javaCV)基于javaCV的跨平台视频录像和基于FFmpeg的快照(截图)库
Stars: ✭ 142 (+491.67%)
Mutual labels:  base64
Base64 Arraybuffer
Encode/decode base64 data into ArrayBuffers
Stars: ✭ 200 (+733.33%)
Mutual labels:  base64
Blooddy crypto
ActionScript (AS3) library for processing binary data. This library contains MD5, SHA-1, SHA-2 ( SHA-224 и SHA-256 ), Base64, CRC32 algorithms, JSON encoder & decoder as well as PNG and JPEG encoders.
Stars: ✭ 83 (+245.83%)
Mutual labels:  base64
Base64simd
Base64 coding and decoding with SIMD instructions (SSE/AVX2/AVX512F/AVX512BW/AVX512VBMI/ARM Neon)
Stars: ✭ 115 (+379.17%)
Mutual labels:  base64
Wx Cardscanner
名片扫描-微信小程序,包括腾讯 ai 开放平台的使用,以及在小程序中实现图片转 Base64 的方法。
Stars: ✭ 156 (+550%)
Mutual labels:  base64
Base64captcha
captcha of base64 and diversity
Stars: ✭ 1,050 (+4275%)
Mutual labels:  base64
Base100
base💯 - Encode your data into emoji
Stars: ✭ 244 (+916.67%)
Mutual labels:  base64
Myutils
🙏 提供时间轴转星座|生肖工具、系统存储空间获取工具、文件大小格式化工具、获取指定文件大小工具、AES加密解码工具(支持android端平台加密解密,java端和android端相互加密解密)、SharePreference操作工具、 File文件操作工具、日期获取和计算工具、界面跳转Intent操作工具、字符串验证和数值转换操作工具、手机震动工具、系统资源操作工具、网络检测工具、 wifi操作工具、单位换算工具、zip压缩和解压操作工具、XML解析操作工具(只支持几种指定格式)、图片加载和处理工具,数据库操作(增删改查)工具、Base64编码解码工具、MD5加密工具。
Stars: ✭ 130 (+441.67%)
Mutual labels:  base64
Basecrack
Decode All Bases - Base Scheme Decoder
Stars: ✭ 196 (+716.67%)
Mutual labels:  base64
Compress.js
A simple JavaScript based client-side image compression algorithm
Stars: ✭ 86 (+258.33%)
Mutual labels:  base64
Weapp Qrcode Base64
微信小程序生成二维码的插件,基于base64编码输出二维码,不依赖canvas
Stars: ✭ 100 (+316.67%)
Mutual labels:  base64
Base64 Avx512
Code for paper "Base64 encoding and decoding at almost the speed of a memory copy"
Stars: ✭ 158 (+558.33%)
Mutual labels:  base64
Shinobi
☮️ 🇵🇸 Shinobi CE - The Free Open Source CCTV platform written in Node.JS (Camera Recorder - Security Surveillance Software - Restreamer
Stars: ✭ 1,099 (+4479.17%)
Mutual labels:  base64
Python Benedict
dict subclass with keylist/keypath support, I/O shortcuts (base64, csv, json, pickle, plist, query-string, toml, xml, yaml) and many utilities. 📘
Stars: ✭ 204 (+750%)
Mutual labels:  base64
Weird Json
A collection of strange encoded JSONs. For connoisseurs.
Stars: ✭ 53 (+120.83%)
Mutual labels:  base64
Pyecharts Snapshot
renders the output of pyecharts as png, jpeg, gif, svg, eps, pdf and raw base64
Stars: ✭ 142 (+491.67%)
Mutual labels:  base64
Base64 Encoder
Base64 Encoder
Stars: ✭ 245 (+920.83%)
Mutual labels:  base64
Datauri
Generate Data-URI scheme via terminal or node.js
Stars: ✭ 212 (+783.33%)
Mutual labels:  base64
Ksprefs
🚀⚡ Kotlin SharedPreferences wrapper & cryptographic preferences android library.
Stars: ✭ 176 (+633.33%)
Mutual labels:  base64

Travis CI Github Build Codacy Badge Codebeat Badge CodeFactor Badge DeepScan grade Analytics

SVG64

Convert SVG to base64 anywhere

Visitor stats

GitHub stars GitHub forks GitHub watchers GitHub followers

Code stats

GitHub code size in bytes GitHub repo size GitHub language count GitHub top language GitHub last commit

About

If you, like me, are using lots of SVGs when developing, you might have come to a point where you need your SVG used as background image or embedded in your javascript file. The only way to do this is to convert your SVG file to a base64 string and then use it where needed. This package does exactly this - it converts SVGs to base64.

This package works in a browser and in a Node environment. Please read along to understand how.

Install

npm i svg64

or

yarn add svg64

or

just download this repository and use the files located in dist folder

or unclude it from unpkg.com

<script src="https://unpkg.com/svg64"></script>

Usage

In a browser

import svg64 from 'svg64'; // or use window.svg64.default

// This is your SVG DOM element
const svg = document.getElementById('svg');

// This is your DOM element that needs SVG background image
const demo = document.getElementById('demo');

// This is your SVG in base64 representation
const base64fromSVG = svg64(svg);

// Add the base64 image as a background to your element
demo.style.backgroundImage = `url(${base64fromSVG})`;

In Node

// Require svg64
const svg64 = require('svg64');

// Import `readFileSync` from the file system module
const { readFileSync } = require('fs');

// Read your SVG file's contents
const svg = readFileSync('./file.svg', 'utf-8');

// This is your SVG in base64 representation
const base64fromSVG = svg64(svg);

Demo

There is a simple demo illustrating how to use the SVG64 module in a browser.

Check it out here

There is a simple demo illustrating how to use the SVG64 module in NodeJS.

Check it out here

LICENSE

MIT


Connect with me:

                     

Support and sponsor my work:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].