Class DesignExportFacade
Identification Accessors
The ID of the export task.
Data Accessors
The target format to which the design is exported.
The status of the export task.
Reference Accessors
The ID of the exported design.
Serialization Methods
Downloads the produced design file to the file system.
A file system has to be available when using this method.
Example:
await export.exportDesignFile('./exports/design.sketch')
Parameters:
An absolute path to which to save the design file or a path relative to the current working directory.
Options
A cancellation token which aborts the asynchronous operation. When the token is cancelled, the promise is rejected and side effects are not reverted (e.g. a partially downloaded file is not deleted). A cancellation token can be created via createCancelToken.
Returns a readable binary stream of the produced design file.
Example:
const resultStream = await export.getResultStream()
const writeStream = fs.createWriteStream('./exports/design.sketch')
resultStream.pipe(writeStream)
Parameters:
Options
A cancellation token which aborts the asynchronous operation. When the token is cancelled, the promise is rejected. A cancellation token can be created via createCancelToken.
A readable file stream.
Returns the URL of the produced design file.
Example:
const url = await export.getResultUrl()
const response = await fetch(url)
if (response.status !== 200) throw new Error('Export result unavailable')
const writeStream = fs.createWriteStream('./exports/design.sketch')
response.pipe(writeStream)
Parameters:
Options
A cancellation token which aborts the asynchronous operation. When the token is cancelled, the promise is rejected. A cancellation token can be created via createCancelToken.
A URL string.
Was this article helpful?