ファイルを扱うためのクラスです。
Properties
Name | Type | Description |
---|---|---|
url | String | |
name | String |
ClassMethods
create(filename, content, progress) -> Promise
新しくファイルを作成します。
引数:
Name | Type | Description |
---|---|---|
filename | String | ファイル名 |
content | Blob | ファイルデータ |
progress | Function | ファイルのアップロード状態を示すオブジェクトを引数として呼び出される関数 |
progressに渡されるオブジェクトは以下の様なkeyを持ちます
Key | Type | Description |
---|---|---|
direction | “upload” or “download” | |
percent | 0 to 100 // may be missing if file size is unknown | |
total | total file size, may be missing | |
loaded | bytes downloaded or uploaded so far |
Return:
Type: Promise
Example
AppPot.File.create('fileA', content, (event) => {
console.log(event);
})
.then((result) => {
console.log(result);
});
InstanceMethods
update(filename, content, progress) -> Promise
指定したファイル名のファイルを更新します。
引数:
Name | Type | Description |
---|---|---|
filename | String | ファイル名 |
content | Blob | ファイルデータ |
progress | Function | ファイルのアップロード状態を示すオブジェクトを引数として呼び出される関数 |
progressに渡されるオブジェクトは以下の様なkeyを持ちます
Key | Type | Description |
---|---|---|
direction | “upload” or “download” | |
percent | 0 to 100 // may be missing if file size is unknown | |
total | total file size, may be missing | |
loaded | bytes downloaded or uploaded so far |
Return:
Type: Promise
Example
file.update('fileA', content, (event) => {
console.log(event);
})
.then((result) => {
console.log(result);
});
remove(filename) -> Promise
指定したファイル名のファイルを削除します。
引数:
Name | Type | Description |
---|---|---|
filename | String | ファイル名 |
Return:
Type: Promise
Example
file.remove('fileA')
.then((result) => {
console.log(result);
});