figma-to-json icon indicating copy to clipboard operation
figma-to-json copied to clipboard

Support reading large files

Open yagudaev opened this issue 6 months ago • 2 comments

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.

yagudaev avatar Jan 31 '24 01:01 yagudaev