Socket
Book a DemoInstallSign in
Socket

fig-kiwi

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fig-kiwi

Reads/writes the figma file format for .fig files or text/html pasteboard data.

latest
npmnpm
Version
0.0.1
Version published
Weekly downloads
167
28.46%
Maintainers
1
Weekly downloads
 
Created
Source

fig-kiwi parser

This module parses the figma file format:

  • HTML file from pasteboard with (figma) (/figma) comments
  • Data in .fig archives (starts with fig-kiwi)
  • Includes typescript definitions derived from the kiwi schema included with pasteboard and file data

Not included:

  • Parsing Blob data in the returned Message (ie for vector networks etc)

Your use of this library is your responsibility, there is no warranty or support of any kind.

Usage

import { readHTMLMessage } from "fig-kiwi";
const html = clipboardData.getData("text/html");
const { message, meta } = readHTMLMessage(html);

message data:

{
  "type": "NODE_CHANGES",
  "sessionID": 0,
  "ackID": 0,
  "pasteID": 96190569,
  "pasteFileKey": "5z51beZU76UT5i92h3clNO",
  "pasteIsPartiallyOutsideEnclosingFrame": false,
  "pastePageId": {
    "sessionID": 0,
    "localID": 1
  }
  // ...
}

Loading a .fig file in node

import { readFigFile, writeFigFile } from "fig-kiwi";
const fig: UInt8Array = readFileSync("vector.fig");
const { message, schema, preview } = readFigFile(fig);
// do something

// write out file
const mod = writeFigFile({ message, schema });
writeFileSync("modified.fig", mod);

FAQs

Package last updated on 05 Jul 2022

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