0

I have a very large array with thousands of items

I tried this solution: Create a file in memory for user to download, not through server of creating an anchor

<a href="data:application/octet-stream;charset=utf-16le;base64,//5mAG8AbwAgAGIAYQByAAoA">text file</a>

~~JSON.stringify on the array caused the tab to freeze~~ Correction: Trying to log out the result caused the tab to freeze, stringify by itself works fine

The data was originally in string form but creating an anchor with that data resulted in a no-op, I'm assuming also because the data was too big, because using dummy data successfully resulted in a file download being triggered

How can I get this item onto my filesystem?

edit/clarification:

There is a very large array that I can only access via the the browser inspector/console. I can't access it via any other language

Community
  • 1
  • 1
CheapSteaks
  • 4,821
  • 3
  • 31
  • 48

1 Answers1

1

Javascript does not allow you to read or write files, except for cookies, and I think the amount of data you are using exceeds the size limit for cookies. This is for security reasons.

However languages such as php, python and ruby allow the reading and writing of files. It appears you are using binary data, so use binary files and write functions.

As to the choice of language : if you already know one use that, or whichever you can get help with. Writing a file is a very basic operation and all three languages are equally good. If you don't know any of these languages you can literally copy and paste the code from their websites.

Arif Burhan
  • 507
  • 4
  • 12