chrome extension how to save data to an alternative file

JavaScript
chrome.storage.sync.set({'theKey': theValue}, optionalSuccessCallback);

Source

Also in JavaScript: