18
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

BlobBuilder でなく Blob のコンストラクタを使う

Posted at

BlobBuilder は deprecated です。

今までこんな感じで書いていたのなら、

old.js
builder = BlobBuilder();
builder.append(src);
blog = builder.getBlob();

Blobでこういう風に書きます。

new.js
blob = new Blob([src]);

src[src] と配列で書きます。

たとえば WebWorker に渡すURLをつくりたいなどで src が JavaScript の場合は、

blob.js
blob = new Blob( [src], {type:"text\/javascript"} );
url = URL.createObjectURL(blob);
worker = new Worker(url);

2番目の引数でMIMEタイプを指定してあげます。

18
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?