figma-to-json
figma-to-json copied to clipboard
Support reading large files
Many of the community files are large .fig files. For example take this file: https://www.figma.com/community/file/1325597018063319916/free-dark-admin-dashboards, it converts to a ~125MB file.
This results in a stack-overflow when we try to process it with the btoa method.
function convertBlobsToBase64(json: any): object {
if (!json.blobs) return json
return {
...json,
blobs: json.blobs.map((blob: any) => {
return btoa(String.fromCharCode(...blob.bytes))
})
}
}
There are more efficient ways to convert a blob to a Base64 we should use.