Questions tagged [html5-filesystem]

The File System API is an abandoned API intending to allow manipulating files and directories in a *virtualized* file system stored by the browser in a sandboxed area of the client system.

IMPORTANT: In April 2014, it was announced on public-webapps that the Filesystem API spec should be considered "clearly dead," as browsers have shown little interest in implementing it.


The File System API simulates a sandboxed virtualized file system that can be used to manipulate files and directories.

In spite of its name, the File System API cannot directly access the local file system. This is probably the most misunderstood aspect (and commonly asked question) about this API. For example, the API cannot be used to GetFile('C:\Users\Public\Desktop\foobar.txt') from the client file system. Likewise, the API cannot write directly to the client file system.

When writing data to the local system, web clients (browsers) do not locally store files according to their (virtual) file names as created in the script. Creating a file named "login.txt" in the API does not cause the client to store a real file called "login.txt" on the local file system. Google Chrome, for example, will only store a numerically named file (e.g., "00004") in a directory dedicated to sandboxed storage on the client device. Therefore the File System API cannot be used to write to the local file system in any way intended for external/outside access to the sandboxed storage area. In some environments, best practices for secure coding may prohibit the persistent storage of sensitive data through the File System API, as malicious code running locally on the host machine may gain access to the sandboxed storage area.

To prevent local storage of malicious code, the API prohibits storage of executable files (such as .exe files) in the virtualized file system.

See Also

323 questions
9
votes
1 answer

How Mega downloads a file?

when you download a file from MEGA service, a web page to display a download progress bar will appear. After the bar reaches 100%, your browser will notify users to save the file into a selected folder. I know that Mega use HTML5 FileSystem API to…
tuandhq
  • 99
  • 1
  • 1
  • 2
8
votes
3 answers

Accessing file data after download in Chrome...?

I'm writing an extension that would ideally read files after they are downloaded (through the normal download process). Is that possible? I can get the filename through chrome.downloads operations, but I can't find ways of reading the actual bytes.…
7
votes
1 answer

Javascript testing with mocha the html5 file api?

I have simple image uploader in a website and a javascript function which uses FileReader and converts image to base64 to display it for user without uploading it to actual server. function generateThumb(file) { var fileReader = new…
sarunast
  • 2,443
  • 3
  • 27
  • 37
7
votes
0 answers

Chrome App SecurityError on file creation

I have the following code: chrome.runtime.getPackageDirectoryEntry(function(directoryEntry) { directoryEntry.getFile("files/test.txt", {create: true, exclusive: false}, function(fileEntry) { console.log(fileEntry); }, …
sollniss
  • 1,895
  • 2
  • 19
  • 36
7
votes
1 answer

How can I retrieve a file's size using the HTML5 FileSystem interface?

How might I learn the size of a file located in a local filesystem exposed through the HTML5 API? I'm expecting something along the lines of, fileSystem.root.getFile(path, { create: false }, function (fileEntry) { // fileEntry.size -…
Taron Mehrabyan
  • 2,199
  • 2
  • 20
  • 27
7
votes
2 answers

Why does this filesystem api requestQuota call fail?

I'm writing an HTML5 app to run in Chrome but it will be on the local filesystem (so they'll start it by double-clicking an html file). It is throwing an error when I try to access the filesystem and I think it's because it's a local file. Is there…
Don Rhummy
  • 24,730
  • 42
  • 175
  • 330
7
votes
1 answer

How to detect directory select capability in browsers?

I am trying to find out if browser has ability to select folders, not just multiple files. Current Chrome supports this (example: http://html5-demos.appspot.com/static/html5storage/demos/upload_directory/index.html). Apparently, it works in Chrome…
mvbl fst
  • 5,213
  • 8
  • 42
  • 59
7
votes
4 answers

Clear HTML5 Filesystem API

How does one completely empty (or delete all files in) a filesystem? Is there no 1 line solution like localStorage (localStorage.clear())? Or am I missing something really, really obvious? Apparently, I wasn't very clear. I'm referring to the HTML5…
J. Chase
  • 1,393
  • 1
  • 10
  • 10
6
votes
2 answers

Access all files within a given folder (The File System Access API)

Can I use the File System Access API (https://web.dev/file-system-access/) to create something like a file explorer within a website (react). I plan to make a simple online file explorer that lets you browse open a folder and then lets you browse…
6
votes
2 answers

Chrome Apps : How to save blob content to fileSystem in the background?

In Chrome Apps, I'm downloading a blob content from a server using JavaScript XHR (Angular $http GET in particular, with response type 'blob') How should I save this to chrome application's file system? Currently using an Angular wrapper on HTML5…
6
votes
2 answers

e.dataTransfer.files.length showing up as 0

I am doing a pretty standard drag and drop feature in HTML5. However, for some reason e.target.dataTransfer showing up as undefined. I am new to javascript. Any help will be appreciated. This is the java script.
Tech for good
  • 177
  • 2
  • 13
6
votes
3 answers

HTML5 FileSystem API

I have created file 'log.txt' by fileSystem API function initFS(grantedBytes) { window.requestFileSystem(window.PERSISTENT, grantedBytes, function (filesystem) { fs = filesystem; fs.root.getFile('log.txt', { create: true,…
6
votes
5 answers

Local editors in HTML5

I am wondering if the current state of HTML5 makes it possible to edit local files. More precisely, I mean : The files are not served by a server (they are on file://), or in the worst case, a local server The editor is either on the local…
nialna2
  • 2,056
  • 2
  • 25
  • 33
6
votes
0 answers

HTML5 Filesystem API: downloading a sandboxed file?

I have some data in indexeddb files, and I'd like to allow my users to download that data to import into other applications. I can use Blobs to do this easily: var blob = new Blob(['herp!'], {type: 'application/octet-stream'}); var iframe =…
Polly
  • 549
  • 5
  • 11
6
votes
1 answer

Wrong orientation when image captured by HTML5 file api on IOS 6.0

I am using HTML5 file api on mobile web app for image uploading utility. I am capturing image using camera and upload it to server. Problem is that if I capture portrait image the uploaded image automatically converted to Landscape.
Milan V.
  • 697
  • 1
  • 6
  • 22
1
2
3
21 22