Methods to make is easier to manipulate a Sketch file
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
json
.gitignore
.npmignore
README.md
generateId.js
index.js
package.json
prettier.config.js

README.md

sketch-file

A Sketch file is a zip file containing a bunch of JSON files.

This package aims to make is easier to manipulate such a file.

Installation

npm install sketch-file

Usage

There are 4 different methods available:

readSketchFile

(filePath: string) => Promise<{
  document: {},
  meta: {},
  user: {},
  pages: Array<{}>,
  images: {
    [id: string]: Buffer
  }
}>

createNewSketchFile

(documentId?: string, pages?: Array<{}>) => Promise<{
  document: {},
  meta: {},
  user: {},
  pages: Array<{}>,
  images: {
    [id: string]: Buffer
  }
}>

writeSketchFile

(sketchDocument: {
  document: {},
  meta: {},
  user: {},
  pages: Array<{}>,
  images: {
    [id: string]: Buffer
  }
}, filePath: string) => Promise<void>

generateId

;(seed?: string) => string