
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
taro-wxml-to-canvas
Advanced tools
wxml-to-canvas for Taro,小程序内通过静态模板和样式绘制 canvas,导出图片,可用于生成分享图等场景。
实例代码不可运行,作为与 wxml-to-canvas 比较
import WxmlToCanvas from 'taro-wxml-to-canvas'
export default class Poster extends Component<Props, State> {
private canvasRef: RefObject<WxmlToCanvas>
private canvasWidth = Taro.getSystemInfoSync().windowWidth || 375
private canvasHeight = Taro.getSystemInfoSync().windowHeight || 600
constructor(props) {
super(props)
this.state = {}
this.canvasRef = createRef()
}
componentDidMount() {
this.renderToCanvas()
}
getWxml() {
const { bg, imgUrl } = this.props
const wxml = `
<view class="poster-share">
<view class="poster-wrap">
<image class="poster-bg" src="${bg}"></image>
<image class="poster-code" src="${imgUrl}"></image>
</view>
</view>
`
return wxml
}
renderToCanvas = async () => {
const wxml = this.getWxml()
const style = {
posterShare: {},
posterWrap: {},
posterBg: {},
posterCode: {},
}
try {
const res = await this.canvasRef.current.renderToCanvas({ wxml, style })
console.log('render done', res)
} catch (err) {
console.log('canvas err', err)
}
}
renderToCanvas = () => {
const setTempFile = this.canvasRef.current.canvasToTempFilePath()
setTempFile
.then(res => {
console.log(res.tempFilePath)
})
.catch(() => {
console.log('oops... something error')
})
}
render() {
return (
<View>
<View className="wxml-wrap">
<WxmlToCanvas
ref={this.canvasRef}
width={this.canvasWidth}
height={this.canvasHeight}
></WxmlToCanvas>
</View>
<View className="save-btn" onClick={this.renderToCanvas}>
保存图片
</View>
</View>
)
}
}
FAQs
wxml-to-canvas for taro
The npm package taro-wxml-to-canvas receives a total of 6 weekly downloads. As such, taro-wxml-to-canvas popularity was classified as not popular.
We found that taro-wxml-to-canvas demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.