为什么使用blob? [英] Why are blobs used?
问题描述
Blob是Linairy Large OBjects,但为什么会使用它们,特别是在JavaScript的上下文中?
如果你搜索interwebz,你会得到很多blob的定义,但不是为什么使用它们。
所以我的问题是:
- 的为什么强>? (在哪种情况下,用例?)
- 特别是关于Cordova中的filestorage(所以通过JavaScript)
- 使用blob时增值是什么。
<示例:
将数据存储到文件系统(通过JavaScript)时,教程首先将String转换为blob,然后再存储。但为什么?您可以将String值写入文件,它不需要是blob。
编辑:可以看到Cordova中blob使用的示例这里
提前致谢!
使用blob时的附加值是什么。
示例:将数据存储到文件系统(通过JavaScript),
教程首先在存储之前将String转换为blob。但是
为什么?您可以将String值写入文件,它不需要
作为blob。
A Blob
可以存储字符串
,数字
,数组
, ArrayBuffer
,布尔值
单个或多个文件
对象,继承自 Blob
,或多个 Blob
s。
使用 Blob
而不是 String
的一个示例优势是存储单个或多个文件
单个 Blob
中的对象,而不是可能冗长的数据URI $
数据URI
中的c $ c>或数据URI
。
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!
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 Blob
s.
One example advantage to using Blob
s 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
.
这篇关于为什么使用blob?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!