The FS object

Slowdown is a coroutine-based framework that requires the cooperative version of disk IO. The FS object holds those cooperative interfaces.

import gevent
import slowdown.fs

fs = slowdown.fs.FS()

def main():
    if not fs.os.path.exists('test.txt'):
        file ='test.txt', 'wb')

io_jobs = fs.spawn()

You can get the FS object from the Application object without creating it yourself.

# The first time the script is loaded, the "initialize(mapfs)" of the
# script is executed.
def initialize(mapfs):
    global fs
    fs = mapfs.application.fs

def GET(rw):
    with'test.html', 'rb') as file:
        content =

Opening files

You can use the open method of the FS object to open a file. When the is called a gevent.fileobject is returned, see gevent.fileobject for details.


Currently, only opening files in binary mode is supported.

Miscellaneous FS interfaces

slowdown.fs.FS.os is the cooperative version of the os module. It provides the following interfaces:

access, chmod, chown, close, closerange, fchmod, fchown, fstat, fstatvfs, ftruncate, fwalk, lchown, link, listdir, lstat, makedirs, mkdir, open, remove, removedirs, rename, renames, rmdir, stat, unlink, walk

slowdown.fs.FS.os.path is the cooperative version of the os.path module. It provides the following interfaces:

abspath, exists, getatime, getctime, getmtime, getsize, isdir, isfile, islink, ismount, lexists, realpath, relpath