Here are a few helper functions that can help you get on the right track to building a simple chrome app that can read and modify the user’s file system:

Get Full Path

In order to get the full path for a DirectoryEntry or a FileEntry you can use the following function:

Reading From A Directory

In order to get the contents of a folder you can use the following function:

Recursively Reading From A Directory

In order to get the contents of a folder and all of it subfolders recursively you can use the following function:

Reading File Contents As Text

In order to get the contents of a file as text you can use the following function:

Writing File Contents AS Text

In order to set the contents of a file as text you can use the following function:

Final Notes

As you may have noticed, all of these functions use callback functions in order to indicate when the action is finished. In the case of writing a file, the callback is optional and is used to indicate that the file has been written. In the end this post is mostly for my benefit, but maybe it will help you out as well! šŸ˜Ž


Leave a Reply

Your email address will not be published. Required fields are marked *