3

Blobs are Linairy Large OBjects, but why are they used, especially in the context of JavaScript?

If you search the interwebz, you get alot of definitions of blobs, but not why they are used.

So my questions are:

  • Why? (in which context, use cases?)
    • Especially regarding filestorage in Cordova (so by means of JavaScript)
  • What is the added value when working with blobs.

Example: When storing data to the filesystem (by means of JavaScript), tutorials first convert the String to a blob before its stored. But Why? You could just write the String value to a file, it doesn't need to be a blob.

Edit: An example of blob usage in Cordova can be seen here

Thanks in advance!

gillesC
  • 525
  • 1
  • 4
  • 20
  • https://developer.mozilla.org/en-US/docs/Web/API/Blob – theaccordance May 03 '16 at 05:53
  • @theaccordance I've read that, it's like I said. There is alot of information about what a blob is. But I don't find real-world cases were blobs are used, and for which purpose – gillesC May 03 '16 at 05:54
  • You generally don't use them in JavaScript unless you're interacting with raw file data – theaccordance May 03 '16 at 05:56
  • 1
    Please check below thread for details http://stackoverflow.com/questions/5285857/when-is-using-mysql-blob-recommended – Deepak Dholiyan May 03 '16 at 06:13
  • Please check below thread for links http://stackoverflow.com/questions/5285857/when-is-using-mysql-blob-recommended http://stackoverflow.com/questions/1717264/should-i-use-mysql-blob-field-type http://stackoverflow.com/questions/11624807/what-is-the-differences-between-blob-and-text-in-mysql-data-types – Deepak Dholiyan May 03 '16 at 06:15

1 Answers1

1

What is the added value when working with blobs.

Example: When storing data to the filesystem (by means of JavaScript), tutorials first convert the String to a blob before its stored. But Why? You could just write the String value to a file, it doesn't need to be a blob.

A Blob can store String, Number, Array, ArrayBuffer, Boolean a single or multiple File objects, which inherits from Blob, or multiple Blobs.

One example advantage to using Blobs instead of String would be storing single or multiple File objects within a single Blob instead of a possibly lengthy data URI, or data URI within a data URI.

guest271314
  • 1
  • 10
  • 82
  • 156