Skip to content

Instantly share code, notes, and snippets.

figma.showUI(`<script>
let imurl = 'https://66.media.tumblr.com/7af65560449c91e8cd82a4a3478f5e0b/tumblr_pb7bt5CTrS1qzdllao1_1280.jpg'
fetch(imurl).then(r => r.arrayBuffer()).then(a =>
parent.postMessage({ pluginMessage: ["imdata", new Uint8Array(a)] }, '*'))
</script>`, { visible:false, width:200, height:200 })
figma.ui.onmessage = msg => {
if (msg[0] == "imdata") {
let data = msg[1] as Uint8Array
let imageHash = figma.createImage(new Uint8Array(data)).hash
const rect = figma.createRectangle()

The PATH is an important concept when working on the command line. It's a list of directories that tell your operating system where to look for programs, so that you can just write script instead of /home/me/bin/script or C:\Users\Me\bin\script. But different operating systems have different ways to add a new directory to it:

Windows

  1. The first step depends which version of Windows you're using:
  • If you're using Windows 8 or 10, press the Windows key, then search for and