FileSystem API was introduced in AppEngine last year. A great feature. I tried using it more than a couple of times and ended up with one problem or the other. Some of the notable issues include:
- What should be the filename during create and save? The name given during create was only name-part and cannot be used during read. Read must use fullpath.
- If you use fullpath, you cannot use it to delete the file.
After a bunch of experiments, I concluded that it is best to use BlobKey.
As a contribution, I have published the code that would help you out working with the low-level API at Github – https://github.com/gvaish/gae-utils/. The actual class – BlobstoreFS – is available here.
The following methods are available:
save: To save contents to a file. You can either provideBlobKeyof an existing file if you wish to overwrite the contents.delete: Delete the file, along with the associatedBlobKey.open: Gives youInputStreamfor you to be able to read the raw contentsreadToEnd: ReturnsStringcontaining the file contents.
