Search code examples
javascriptvisual-studiovisual-studio-2013winjswindows-8.1

Create and Write files in windows 8.1 store apps by JavaScript and WinJS


I am building a app for win 8.1 store and i need to create some files during app execution. how this is possible only by js or WinJS. i found command for writing and reading but not for creating.


Solution

  • You can use:

      folder.createFileAsync(
               fileName, 
               Windows.Storage.CreationCollisionOption.replaceExisting, 
               Windows.Storage.Streams.UnicodeEncoding.utf8
      );
    

    the folder object can be a StorageFolder object, like for example:

     Windows.Storage.ApplicationData.current.localFolder