Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8658161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:41:50+00:00 2026-06-12T15:41:50+00:00

I’ve built an app for Windows Store that writes to local files using Windows.Storage.FileIO

  • 0

I’ve built an app for Windows Store that writes to local files using Windows.Storage.FileIO (createFileAsync, readTextAsync and writeTextAsync).

My plan is to use the file as a simple database (the data is simply JSON formatted user information). Is this a bad idea?

Are the files written this way really persistent (or are they deleted when the app is updated)? Can the user themselves delete them (for example through deleting cookies/temp internet files or the likes)?

I’m just wondering how files written to the disk locally by apps are treated by the “Metro” environment…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:41:51+00:00Added an answer on June 12, 2026 at 3:41 pm

    The question of whether it’s a “bad idea” is quite subjective, so probably not the right venue for that.

    However, in terms of how Windows Store apps treat files you store, if you create and/or edit files using Windows.Storage.ApplicationData.current.localFolder, these files will be available until the user uninstalls the app. If you push an update of your app to the store, and the user downloads and installs the update, the files will remain on the user’s machine, unless you explicitly modify them programmatically.

    In two apps that I’ve built, I leverage the localFolder to store JSON representations of the app’s data so that I can minimize startup time, and refresh the data in the background once the app has started up and rendered its initial UI to the user.

    Here’s what my code (which could probably be optimized a bit) looks like:

    appData.current.localFolder.createFileAsync("leaderboard.txt", 
        Windows.Storage.CreationCollisionOption.openIfExists)
    .then(function (file) {
        leaderboardFile = file;
        return Windows.Storage.FileIO.readTextAsync(file)
    })
    .then(function (fileContents) {
        cachedLeaderboard = fileContents;
        if (!cachedLeaderboard || isRefresh) {
            return WinJS.xhr(xhrOptions)
        }
        else {
            cachedLeaderboard = JSON.parse(cachedLeaderboard);
            List = new WinJS.Binding.List(cachedLeaderboard);
            completed(List);
        }
    })
    .then(function (result) {
        if (result) {
           var items = JSON.parse(result.responseText).d;
           localLeaderboard = items;
           return Windows.Storage.FileIO.writeTextAsync(leaderboardFile, 
               JSON.stringify(localLeaderboard))
        }
    })
    .then(function () {
        if (!localLeaderboard)
        localLeaderboard = cachedLeaderboard;
        List = new WinJS.Binding.List(localLeaderboard);
        completed(List);
    })
    

    Basically, the code will check whether the leaderboard.txt file exists (or if the call is a refresh of the data), and if not, make an XHR call to get the data, then create a binding list and pass it back to the caller wrapped in a promise (the promise code isn’t shown). If the file exists, and the request isn’t a refresh, I just parse the text file and create the binding list from that.

    Hope that helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
I am using Paperclip to handle profile photo uploads in my app. They upload
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.