SQLの窓 イラストAC フリー素材

2011年10月25日

Win8 Metro js : ファイル作成

KnownFolders.DocumentsLibrary | documentsLibrary property

Windows.Storage.KnownFolders.documentsLibrary が返す値は、StorageFolder class で、
ユーザーのドキュメントフォルダに作成されます

StorageFolder class

createFileAsync メソッドでファイルを作成しますが、CreationCollisionOption を指定
しないメソッドを使うと、"ファイル名 (2)" というような名前で作成されます

createFileAsync(String, CreationCollisionOption) method
    function scenario1CreateFile() {
        //Create a empty file sample.txt in user's Document folder, replacing/overwrite the existing file to ensure there is only file be created. 
        Windows.Storage.KnownFolders.documentsLibrary.createFileAsync("sample.txt",
            Windows.Storage.CreationCollisionOption.replaceExisting).then(function (file) {
                id("scenario1Output").innerHTML = '<p>The file <b>sample.txt</b> was created.</p>';
                sampleFile = file;
            });
    }
.then の中にある file の内容を以下の画像で示しています


StorageFile class

【オワコンの最新記事】
posted by at 2011-10-25 14:54 | Comment(0) | オワコン | このブログの読者になる | 更新情報をチェックする
SQLの窓全体の検索
Custom Search
この記事へのコメント
コメントを書く
お名前:

メールアドレス:

ホームページアドレス:

コメント:

※ブログオーナーが承認したコメントのみ表示されます。