I make an application-player for chrome. I want that after changing the track, its name is recorded in a file (erasing the name of the previous one). I can't write to the file. I tried this:

chrome.fileSystem.chooseEntry({type: 'saveFile', suggestedName: 'song.txt'}, function(writableFileEntry) { writableFileEntry.createWriter(function(writer) { writer.write(new Blob([songs[i].title], {type: 'text/plain'})); }, errorHandler); }); 

but it just opens the save to file dialog, but it needs to be done without user intervention

    1 answer 1

    Understood in all. Here are links to videos and docks:

    I used the " syncFileSystem " (the file is saved on Google Drive). In the configuration file you need to register this:

     "permissions": [ "...", "syncFileSystem" ] 

    And the write code itself looks like this:

     chrome.syncFileSystem.requestFileSystem(function (fs) { fs.root.getFile('test.txt', {create:true}, getEntryCallback, errorCallback); }); 
    • Please try to leave a little more detailed answers. if the external links are “rotten”, your answer will become useless for the knowledge base that this site is. - aleksandr barakin
    • the link leads to the official documentation. If it becomes rotten, then the question itself is likely to be irrelevant. But I can copy a bit from there, if it matters - ivan0biwan