wpcomfs – A Filesystem

Back in April announced a new REST style API. That got me thinking about writing a filesystem layer to expose that data, along similar lines to the pressfs code I’d written last year.

It is still rough, and only supports read-only public data, but in the spirit of release early (and often) I’m sharing the code for wpcomfs at

Assuming you have FUSE with Python bindings already working on your system you can download this and start trying it out in three easy steps:

  1. mkdir /tmp/wpcomfs
  2. python /tmp/wpcomfs/
  3. mkdir /tmp/wpcomfs/sites/

After those steps you’ll have read-only data for available at /tmp/wpcomfs/sites/

The mount point /tmp/wpcomfs and the site are just examples. You mount wpcomfs where ever you’d like and you can expose public data for any public site hosted on Since there are millions of sites hosted at wpcomfs will only load data for sites that you mkdir.

This also works for sites that are using mapped domain names. For instance mkdir /tmp/wpcomfs/sites/ will provide you with a filesystem layer for


When you mkdir a site you get site data, recent posts, and recent comments. In order to keep interactions with the filesystem responsive this data is only loaded once, when mkdir is run. Running rmdir /tmp/wpcomfs/sites/ will remove the site data.

The top level directory for a site looks like:

$ ls -la /tmp/wpcomfs/sites/
total 14
-r——– 1 root root 7 Jun 6 14:09 ID.txt
-r——– 1 root root 28 Jun 6 14:09 URL.txt
dr——– 2 root root 4096 Jun 6 14:09 comments
-r——– 1 root root 61 Jun 6 14:09 description.txt
dr——– 2 root root 4096 Jun 6 14:09 meta
-r——– 1 root root 18 Jun 6 14:09 name.txt
dr——– 2 root root 4096 Jun 6 14:09 posts

The contents of each file are available in read-only mode:

$ more /tmp/wpcomfs/sites/

All of the dates exposed for files and directories in wpcomfs are based on when the site data was loaded. Basically when mkdir was run for the site.

You can mkdir as many sites as you want. I haven’t tested an upper limit, but I imagine if you load enough of them your system will run out of memory and die.


I have noticed a few bugs. Specifically, in some cases post content runs into some encoding issues and doesn’t get exposed properly at the filesystem level. Another one that I’ve seen is that the comment count number doesn’t show up correctly. Both of these are issues in the Python code that I need to take the time to work out.

While not really a bug, there are also some patterns in this code that I’m not entirely happy with. I’m hoping with a bit more Python experience I’ll be able to simplify those.

Kick The Tires

The code is available at, please give a try and let me know what you think.

Leave a Reply

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