electron/spec/fixtures/pages/filesystem.html

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
735 B
HTML
Raw Normal View History

2016-08-24 01:23:14 +00:00
<script>
const {ipcRenderer} = require('electron')
function onInitFs (fs) {
fs.root.getFile('log.txt', {create: true}, function (fileEntry) {
fileEntry.createWriter(function (fileWriter) {
var blob = new Blob(['Lorem Ipsum'], {type: 'text/plain'});
fileWriter.onwriteend = function() {
ipcRenderer.send('file-system-write-end')
};
fileWriter.onerror = errorHandler
fileWriter.write(blob);
}, errorHandler);
}, errorHandler);
}
navigator.webkitPersistentStorage.requestQuota(5 * 1024 * 1024, function (granted) {
webkitRequestFileSystem(TEMPORARY, granted, onInitFs, errorHandler);
}, errorHandler)
function errorHandler(e) {
ipcRenderer.send('file-system-error', e)
}
</script>