In Chrome App, set file permissions on saved file

363 views Asked by At

I am building a Google Chrome packaged app, and it needs to be able to sometimes save a Blob into a file on the user's hard drive.

The essential features of my code are as follows:

var save = function(blobToSave) {
    // prompt user to choose a location for the saved file
    chrome.fileSystem.chooseEntry({type:'saveFile',suggestedName:'data.blob'},function(file){
        // create writer to write the data to the chosen file   
        file.createWriter(function(fileWriter){
            // write the data
            fileWriter.write(blobToSave);           
        });
    });
};

This works fine, except that the file always seems to be saved with permissions 600 (Instead of the default for the user, which in my case is 644). IE group and other both cannot read.

How can I adjust the above code so that I can either:

a) Set the file permissions myself using something similar to chmod. or b) Make Chrome save the file with default permissions for the user

If it makes a difference, I am using Chrome v 31, on Mac OSX Snowleopard (but I guess the same would apply on any 'nix-based OS)

0

There are 0 answers