Export and Save as SVG File

I am trying to export and save an SVG file.

I have tried exportAsync in following code which is returning svg code, but how i can save it as svg file.

let node = figma.currentPage.selection[0];
node.exportAsync({format: 'SVG'}).then(res => console.log(String.fromCharCode.apply(null, res))).catch(err => console.error(err));

figma.closePlugin();

Please help :slightly_smiling_face:

1 Like

Hey man, this might help you:

1 Like

To export SVGs or PDFs, You can simply post message to UI’s window and save a respective SVG or PDF file using Blob. Hope this helps :raised_hands:

Hi,
I’m actually trying to do the same thing but I just need image and getting this error

Argument of type 'Uint8Array' is not assignable to parameter of type 'number[]'.
  Type 'Uint8Array' is missing the following properties from type 'number[]': pop, push, concat, shift, and 5 more.ts(2345)