← 返回首页
FileReader: FileReader() コンストラクター - Web API | MDN

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

FileReader: FileReader() コンストラクター

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.

メモ: この機能はウェブワーカー内で利用可能です。

FileReader() コンストラクターは、新しい FileReader を作成します。

FileReader の使用方法の詳細については、ウェブアプリケーションからのファイルの使用を参照してください。

In this article

構文

js
new FileReader()

引数

なし。

次のコードスニペットは、FileReader オブジェクトを FileReader() コンストラクターで作成し、引き続きそのオブジェクトを使用する方法を示しています。

js
function printFile(file) { const reader = new FileReader(); reader.onload = (evt) => { console.log(evt.target.result); }; reader.readAsText(file); }

仕様書

Specification
File API
# filereaderConstrctr

ブラウザーの互換性

Enable JavaScript to view this browser compatibility table.

関連情報