Constructor
new Sketch()
- Source:
Properties:
Name | Type | Description |
---|---|---|
repo |
JSZip | The instance of JSZip containing the raw data |
document |
Node | The document data |
meta |
Node | The meta data |
user |
Node | The user data |
pages |
Array.<Page> | Array with all pages of the document |
symbolsPage |
Page | undefined | The "Symbols" page if exists |
symbols |
Array.<Node> | Array with all local symbols (symbols stored in any page of the document) |
foreignSymbols |
Array.<Node> | Array with all foreign symbols used in the document (symbols loaded from libraries) |
layerStyles |
Array.<SharedStyle> | Array with all shared styles of the document |
foreignLayerStyles |
Array.<SharedStyle> | Array with all shared styles used and loaded from external libraries |
textStyles |
Array.<SharedStyle> | Array with all text styles of the document |
foreignTextStyles |
Array.<SharedStyle> | Array with all text styles used and loaded from external libraries |
colors |
Array.<Node> | Array with the document color palette |
gradients |
Array.<Node> | Array with the document gradients palette |
Methods
save(file) → {Promise}
- Source:
Save the document as a sketch file
Example
ns.read('input.sketch').then((sketch) => {
//modify the sketch data
sketch.save('output.sketch')
})
Parameters:
Name | Type | Description |
---|---|---|
file |
string | The file path |
Returns:
- Type
- Promise
saveDir(dir) → {Promise}
- Source:
Save the document into a directory with pretty json
Useful to inspect the json scheme of a sketch file
Parameters:
Name | Type | Description |
---|---|---|
dir |
string | [description] |
Returns:
- Type
- Promise