Skip to content
wip
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.rst

pyfat

CI build status Test coverage overview Codacy Code Quality Python compatibility matrix MIT License

pyfat is a filesystem module for use with PyFilesystem2 for anyone who needs to access or modify files on a FAT filesystem.

pyfat supports FAT12/16/32 as well as the VFAT extension (long file names).

Installation

To install pyfat just run from the root of the project:

$ python setup.py install

Usage

Opener

Use fs.open_fs to open a filesystem with a FAT FS URL:

import fs
my_fs = fs.open_fs("fat:///dev/sda1")

The following URL parameters are supported: encoding and offset

Parameters

encoding

pyfat offers an encoding parameter to allow overriding the default encoding of ibm437 for file names, which was mainly used by DOS and still is a fallback of Linux.

Later versions of Windows were using Windows-1252, also known as CP1252, as encoding. Any encoding known by Python can be used as value for this parameter.

import fs
my_fs = fs.open_fs("fat:///dev/sda1?encoding=cp1252")
offset

Specify an offset in bytes to skip when accessing the file. That way even complete disk images can be read if the location of the partition is known:

import fs
my_fs = fs.open_fs("fat:///dev/sda?offset=32256")
preserve_case

Preserve case when creating files. This will force LFN entries for all created files that do not match the 8DOT3 rules. This defaults to true but can be disabled by setting preserve_case to false:

import fs
my_fs = fs.open_fs("fat:///dev/sda1?preserve_case=false")
read_only

Open filesystem in read-only mode and thus don't allow writes/modifications. This defaults to false but can be enabled by setting read_only to true:

import fs
my_fs = fs.open_fs("fat:///dev/sda1?read_only=true")
utc

Create all timestamps on the filesystem in UTC time rather than local time. Affects all directory entries' creation, modification and access times. This defaults to true but can be disabled by setting utc to false:

import fs
my_fs = fs.open_fs("fat:///dev/sda1?utc=false")

Testing

Tests are located at the tests directory. In order to test your new contribution to pyfat just run

$ python setup.py test

from your shell.

About

Python based FAT12/16/32 implementation with VFAT support

Topics

Resources

License

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.