Methods
load(source) → {Promise}
Load the source content of a sketch file and return a promise with
a Sketch instance
Parameters:
Name | Type | Description |
---|---|---|
source |
String | Content of a sketch file |
Returns:
- Type
- Promise
read(file) → {Promise}
Read a sketch file and returns a promise with a Sketch instance
Example
//Load a file
nodeSketch.read('design.sketch').then(sketch => {
console.log(sketch);
}).catch(err => {
console.error('Error reading the file');
});
//Load an array of files
nodeSketch.read(['design.sketch', 'other-design.sketch']).then(files => {
let [design, other] = files;
console.log(design);
console.log(other);
}).catch(err => {
console.error('Error reading some files');
})
Parameters:
Name | Type | Description |
---|---|---|
file |
Array | String | Can be a path or an array of paths |
Returns:
- Type
- Promise