SoAanyip / note

Write some note.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Differences between createObjectURL and FileReader

SoAanyip opened this issue · comments

time

createObjectURL is synchronously executed
filereader.readasdataurl is asynchronously executed (works with callback)

memory usage

createObjectURL return url with hash, and store object in memory until document triggers unload event (document close) or execute revokeObjectURL
filereader.readasdataurl return base64, that contains many characters, and use more memory than blob url, but removes from memory when you don't use it (by garbage collector)

support

createObjectURL from 10 ie and all modern browsers
filereader.readasdataurl from 10 ie and all modern browsers

CreateObjectURL is more efficient and faster, but if you use many object urls, you need to release urls by revokeObjectURL (for free memmory)

http://stackoverflow.com/questions/31742072/filereader-vs-window-url-createobjecturl