new EzVirtual(form)
- Description:
파일 <-> Text 변경용 라이브러리 실제 화면에서는 new 없이 this.virtual을 호출하는 것으로 자동생성 됩니다.
Parameters:
| Name | Type | Description |
|---|---|---|
form |
nexacro.FormBase |
Members
(static) downloadPath :string
- Description:
변환 완료시 호출할 경로
변환 완료시 호출할 경로
Type:
- string
(static) title :string
- Description:
파일선택 팝업에 표시될 제목
파일선택 팝업에 표시될 제목
Type:
- string
(static) uploadPath :string
- Description:
서버 호출시 호출되는 경로입니다.
서버 호출시 호출되는 경로입니다.
Type:
- string
(static) uploadSuccessCode :string
- Description:
업로드 성공시 코드
업로드 성공시 코드
Type:
- string
Methods
read(charsetopt) → {Promise}
- Description:
파일을 읽어 내용을 String으로 만듭니다.
Example
this.virtual.read("UTF-8").then(function(e){
trace(e.data);
}).catch(function(e){
trace(e.message);
})
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
charset |
string |
<optional> |
'UTF-8'
|
파일의 인코딩 양식 |
Returns:
파일 읽기 수행 결과 Promise
- Type
- Promise
readBase64() → {Promise}
- Description:
파일을 읽어 내용을 Base64 데이터로 만듭니다.
Example
this.virtual.readBase64().then(function(e){
trace(e.data);
}).catch(function(e){
trace(e.message);
})
Returns:
파일 읽기 수행 결과 Promise
- Type
- Promise
readBinary() → {Promise}
- Description:
파일을 읽어 내용을 Binary 데이터로 만듭니다.
Example
this.virtual.readBinary().then(function(e){
trace(e.data);
}).catch(function(e){
trace(e.message);
})
Returns:
파일 읽기 수행 결과 Promise
- Type
- Promise
write(fileNmopt, contentopt, charsetopt) → {Promise}
- Description:
String을 파일로 만들어 다운로드합니다. 런타임 또는 브라우저 자체 기능을 사용합니다. 웹브라우저의 경우 charset을 무시하고 무조건 'UTF-8'로 작성됩니다. 다른 charset을 이용하려면 nexacro.EzVirtual.writeTextWithServer를 사용해 서버에서 처리하도록 합니다.
Example
this.virtual.write("test.txt","Hello Would""UTF-8").then(function(){
trace("다운로드 완료");
}).catch(function(e){
trace(e.message);
})
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
fileNm |
string |
<optional> |
'제목없음.txt'
|
다운로드할 파일 명, |
content |
string |
<optional> |
''
|
파일 내용, |
charset |
string |
<optional> |
'UTF-8'
|
파일의 인코딩 양식, |
Returns:
파일 다운로드 시도 결과 Promise
- Type
- Promise
writeBase64(fileNmopt, contentopt, mimeTypeopt) → {Promise}
- Description:
base64 문자열을 파일로 만들어 다운로드합니다. IE10 이상만 지원 런타임 또는 브라우저 자체 기능을 사용합니다.
Example
this.virtual.writeBase64("test.txt", base64Str, "UTF-8").then(function(){
trace("다운로드 완료");
}).catch(function(e){
trace(e.message);
})
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
fileNm |
String |
<optional> |
'제목없음.txt'
|
다운로드할 파일 명, |
content |
String |
<optional> |
''
|
파일 내용, |
mimeType |
String |
<optional> |
"application/octet-stream"
|
파일유형, |
Returns:
파일 다운로드 시도 결과 Promise
- Type
- Promise
writeBinary(fileNmopt, contentopt, mimeTypeopt) → {Promise}
- Description:
바이너리 문자열을 파일로 만들어 다운로드합니다. IE10 이상만 지원 런타임 또는 브라우저 자체 기능을 사용합니다.
Example
this.virtual.writeBinary("test.txt", bStr, "UTF-8").then(function(){
trace("다운로드 완료");
}).catch(function(e){
trace(e.message);
})
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
fileNm |
string |
<optional> |
'제목없음.txt'
|
다운로드할 파일 명, |
content |
string |
<optional> |
""
|
파일 내용, |
mimeType |
string |
<optional> |
"application/octet-stream"
|
파일유형, |
Returns:
파일 다운로드 시도 결과 Promise
- Type
- Promise
writeTextWithServer(fileNmopt, contentopt, charsetopt) → {Promise}
- Description:
String을 파일로 만들어 다운로드합니다.(서버를 이용해 처리합니다.) 서버의 기능을 이용함으로 nexacro.EzVirtual.downloadPath의 경로가 올바르게 설정되어야 있어야 합니다.
Example
this.virtual.writeTextWithServer("test.txt","Hello Would""UTF-8").then(function(){
trace("다운로드 완료");
}).catch(function(e){
trace(e.message);
})
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
fileNm |
string |
<optional> |
'제목없음.txt'
|
다운로드할 파일 명, |
content |
string |
<optional> |
''
|
파일 내용, |
charset |
string |
<optional> |
'UTF-8'
|
파일의 인코딩 양식, |
Returns:
파일 다운로드 시도 결과 Promise
- Type
- Promise