aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/api/filereader/readastext/index.html
blob: d0f5c80ddf48ee86aeda60072778360e36025a4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
title: FileReader.readAsText()
slug: Web/API/FileReader/readAsText
tags:
  - 파일
  - 파일 API
translation_of: Web/API/FileReader/readAsText
---
<div>{{APIRef("File API")}}</div>

<p><strong><code>readAsText()</code></strong> 메서드는 지정된 {{domxref("Blob")}} 이나 {{domxref("File")}} 의 컨텐츠를 읽기 위해 사용합니다. 읽기  연산이 끝나면, {{domxref("FileReader.readyState","readyState")}}<code>DONE</code>으로 바뀌고, {{event("loadend")}} 이벤트가 트리거 되고, {{domxref("FileReader.result","result")}} 프로퍼티는 파일의 내용을 텍스트 문자열로 가집니다.</p>

<div class="blockIndicator note">
<p><strong>새로운 API 사용가능</strong><br>
 {{domxref("Blob.text()")}} 메서드는 파일을 텍스트로 읽는 프로미스 기반의 새 API 입니다.</p>
</div>

<h2 id="문법">문법</h2>

<pre class="syntaxbox"><em>instanceOfFileReader</em>.readAsText(blob[, encoding]);</pre>

<h3 id="매개변수">매개변수</h3>

<dl>
 <dt><code>blob</code></dt>
 <dd>읽어 들일 {{domxref("Blob")}} 이나 {{domxref("File")}}</dd>
 <dt><code>encoding</code> {{optional_inline}}</dt>
 <dd>반환 데이터에 사용될 문자열 인코딩을 지정. 매개변수가 지정되지 않으면 기본적으로 UTF-8이라고 가정합니다.</dd>
</dl>

<h2 id="명세">명세</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName("File API", "#readAsDataText", "readAsText()")}}</td>
   <td>{{Spec2("File API")}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="브라우저_호환성">브라우저 호환성</h2>



<p>{{Compat("api.FileReader.readAsText")}}</p>

<h2 id="함께_보기">함께 보기</h2>

<ul>
 <li>{{domxref("FileReader")}}</li>
</ul>