* docs: apply arrow functions to app.makeSingleInstance example * docs: apply arrow functions to session docs * docs: change normal to arrow functions in File object docs
		
			
				
	
	
		
			31 lines
		
	
	
	
		
			804 B
			
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
	
		
			804 B
			
		
	
	
	
		
			Markdown
		
	
	
	
	
	
# `File` Object
 | 
						|
 | 
						|
> Use the HTML5 `File` API to work natively with files on the filesystem.
 | 
						|
 | 
						|
The DOM's File interface provides abstraction around native files in order to
 | 
						|
let users work on native files directly with the HTML5 file API. Electron has
 | 
						|
added a `path` attribute to the `File` interface which exposes the file's real
 | 
						|
path on filesystem.
 | 
						|
 | 
						|
Example of getting a real path from a dragged-onto-the-app file:
 | 
						|
 | 
						|
```html
 | 
						|
<div id="holder">
 | 
						|
  Drag your file here
 | 
						|
</div>
 | 
						|
 | 
						|
<script>
 | 
						|
  document.addEventListener('drop', (e) => {
 | 
						|
    e.preventDefault();
 | 
						|
    e.stopPropagation();
 | 
						|
 | 
						|
    for (const f of e.dataTransfer.files) {
 | 
						|
      console.log('File(s) you dragged here: ', f.path)
 | 
						|
    }
 | 
						|
  });
 | 
						|
  document.addEventListener('dragover', (e) => {
 | 
						|
    e.preventDefault();
 | 
						|
    e.stopPropagation();
 | 
						|
  });
 | 
						|
</script>
 | 
						|
```
 |