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

@sledgeli/to-compilation

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sledgeli/to-compilation

A helper for image type conversion and adding image watermark.

  • 2.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

to-compilation

A helper for image type conversion and adding image watermark.

Install 安装

yarn add @sledgeli/to-compilation

# or

npm install --save @sledgeli/to-compilation

Usage 使用示例,return 一个转换后的 File 文件对象

import { toTransform, toAddWaterMark } from "@sledgeli/to-compilation";

const fileUrl = ref("");
const tarnsform = async () => {
  const file = await toTransform(fileUrl.value);
  console.log(file, "tarnsform");
};

const addWaterMark = async () => {
  // fileUrl 需要先转换为 File 对象
  const wmFile = await toAddWaterMark(fileUrl.value);
  console.log(file, "watermark");
};

argument 参数 —— toTransform

参数名说明类型默认值是否必填
fileOrUrl待转换的文件/图像 urlFilestringYes
toType期望转换的类型string'webp'No
optionscanvas 配置参数object{ quality: 1, color_space_conversion: true, alpha_filtering: "best", alpha_compression: "best", }No

argument 参数 —— toAddWaterMark

参数名说明类型默认值是否必填
file待添加水印的图片文件FileYes
waterMarkText水印文字string' waterMark 'No
font水印字号大小和字体string"12px arial"No
fillStyle水印样式—颜色和透明度string"rgba(255, 0, 0, .2)"No

FAQs

Package last updated on 29 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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