pyfatfs


Namepyfatfs JSON
Version 1.1.0 PyPI version JSON
download
home_page
SummaryFAT12/FAT16/FAT32 implementation with VFAT support
upload_time2024-03-03 20:50:43
maintainer
docs_urlNone
author
requires_python~=3.8
licenseMIT License Copyright (c) 2018-2024 pyfatfs contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords filesystem pyfilesystem2 fat12 fat16 fat32 vfat lfn
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://img.shields.io/github/actions/workflow/status/nathanhi/pyfatfs/test.yml?style=flat-square
    :target: https://github.com/nathanhi/pyfatfs/actions/workflows/test.yml
    :alt: CI build status
.. image:: https://img.shields.io/readthedocs/pyfatfs?style=flat-square
    :target: https://pyfatfs.readthedocs.io/
    :alt: Read the Docs
.. image:: https://img.shields.io/coveralls/github/nathanhi/pyfatfs?style=flat-square
    :target: https://coveralls.io/github/nathanhi/pyfatfs
    :alt: Test coverage overview
.. image:: https://img.shields.io/codacy/grade/3def4d7b0bcd4b6f9aa4bb64e0338540?style=flat-square
    :target: https://app.codacy.com/gh/nathanhi/pyfatfs
    :alt: Codacy Code Quality
.. image:: https://img.shields.io/pypi/pyversions/pyfatfs?style=flat-square
    :target: https://github.com/nathanhi/pyfatfs
    :alt: PyPI - Python Version
.. image:: https://img.shields.io/pypi/v/pyfatfs?style=flat-square
    :target: https://pypi.org/project/pyfatfs
    :alt: PyPI
.. image:: https://img.shields.io/github/license/nathanhi/pyfatfs.svg?style=flat-square
    :target: https://github.com/nathanhi/pyfatfs/blob/HEAD/LICENSE
    :alt: MIT License

pyfatfs
=======

pyfatfs is a filesystem module for use with `PyFilesystem2 <https://pypi.org/project/fs/>`_
for anyone who needs to access or modify files on a FAT filesystem. It also
provides a low-level API that allows direct interaction with a FAT filesystem
without PyFilesystem2 abstraction.

pyfatfs supports FAT12/FAT16/FAT32 as well as the VFAT extension (long file names).

Installation
------------

pyfatfs is available via PyPI as ``pyfatfs``, so just execute the following
command to install the package for your project:

.. code-block:: bash

   $ pip install pyfatfs


Usage
=====

The easiest way to get started with pyfatfs is to use it in conjunction
with PyFilesystem2:

PyFilesystem2
-------------

.. pyfilesystem-quickstart-begin

Use fs.open_fs to open a filesystem with a FAT `FS URL <https://pyfilesystem2.readthedocs.io/en/latest/openers.html>`_:

.. code-block:: python

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


Parameters
''''''''''

It is possible to supply query parameters to the URI of the
PyFilesystem2 opener to influence certain behavior; it can
be compared to mount options. Multiple parameters can be
supplied by separating them via ``ampersand (&)``.

encoding
^^^^^^^^

pyfatfs offers an encoding parameter to allow overriding the
default encoding of ibm437 for file names, which was mainly
used by DOS and still is the `default on Linux <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/fat/Kconfig?h=v5.10#n81>`_.

Any encoding known by Python can be used as value for this
parameter, but keep in mind that this might affect interoperability
with other systems, especially when the selected encoding/codepage
is not native or supported.

Please note that this only affects encoding of the 8DOT3 short file names, not
long file names of the VFAT extension, as LFN are always stored as UTF-16-LE.

.. code-block:: python

   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:

.. code-block:: python

   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``:

.. code-block:: python

   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``:

.. code-block:: python

   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.

.. code-block:: python

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


lazy_load
^^^^^^^^^

If set to ``true`` (default), the directory entries are loaded only when accessed
to increase performance with larger filesystems and resilience against
recursion / directory loops.

.. code-block:: python

    import fs
    my_fs = fs.open_fs("fat:///dev/sda1?lazy_load=false")
.. pyfilesystem-quickstart-end

Testing
-------

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

.. code-block:: bash

    $ python setup.py test

from your shell.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pyfatfs",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "~=3.8",
    "maintainer_email": "",
    "keywords": "filesystem,PyFilesystem2,FAT12,FAT16,FAT32,VFAT,LFN",
    "author": "",
    "author_email": "\"Nathan-J. Hirschauer\" <nathanhi@deepserve.info>",
    "download_url": "https://files.pythonhosted.org/packages/44/3f/d08f1dbc44a7eef9c7fb355b83423fbd15bb3e487c250479a2c179cb39bf/pyfatfs-1.1.0.tar.gz",
    "platform": null,
    "description": ".. image:: https://img.shields.io/github/actions/workflow/status/nathanhi/pyfatfs/test.yml?style=flat-square\n    :target: https://github.com/nathanhi/pyfatfs/actions/workflows/test.yml\n    :alt: CI build status\n.. image:: https://img.shields.io/readthedocs/pyfatfs?style=flat-square\n    :target: https://pyfatfs.readthedocs.io/\n    :alt: Read the Docs\n.. image:: https://img.shields.io/coveralls/github/nathanhi/pyfatfs?style=flat-square\n    :target: https://coveralls.io/github/nathanhi/pyfatfs\n    :alt: Test coverage overview\n.. image:: https://img.shields.io/codacy/grade/3def4d7b0bcd4b6f9aa4bb64e0338540?style=flat-square\n    :target: https://app.codacy.com/gh/nathanhi/pyfatfs\n    :alt: Codacy Code Quality\n.. image:: https://img.shields.io/pypi/pyversions/pyfatfs?style=flat-square\n    :target: https://github.com/nathanhi/pyfatfs\n    :alt: PyPI - Python Version\n.. image:: https://img.shields.io/pypi/v/pyfatfs?style=flat-square\n    :target: https://pypi.org/project/pyfatfs\n    :alt: PyPI\n.. image:: https://img.shields.io/github/license/nathanhi/pyfatfs.svg?style=flat-square\n    :target: https://github.com/nathanhi/pyfatfs/blob/HEAD/LICENSE\n    :alt: MIT License\n\npyfatfs\n=======\n\npyfatfs is a filesystem module for use with `PyFilesystem2 <https://pypi.org/project/fs/>`_\nfor anyone who needs to access or modify files on a FAT filesystem. It also\nprovides a low-level API that allows direct interaction with a FAT filesystem\nwithout PyFilesystem2 abstraction.\n\npyfatfs supports FAT12/FAT16/FAT32 as well as the VFAT extension (long file names).\n\nInstallation\n------------\n\npyfatfs is available via PyPI as ``pyfatfs``, so just execute the following\ncommand to install the package for your project:\n\n.. code-block:: bash\n\n   $ pip install pyfatfs\n\n\nUsage\n=====\n\nThe easiest way to get started with pyfatfs is to use it in conjunction\nwith PyFilesystem2:\n\nPyFilesystem2\n-------------\n\n.. pyfilesystem-quickstart-begin\n\nUse fs.open_fs to open a filesystem with a FAT `FS URL <https://pyfilesystem2.readthedocs.io/en/latest/openers.html>`_:\n\n.. code-block:: python\n\n   import fs\n   my_fs = fs.open_fs(\"fat:///dev/sda1\")\n\n\nParameters\n''''''''''\n\nIt is possible to supply query parameters to the URI of the\nPyFilesystem2 opener to influence certain behavior; it can\nbe compared to mount options. Multiple parameters can be\nsupplied by separating them via ``ampersand (&)``.\n\nencoding\n^^^^^^^^\n\npyfatfs offers an encoding parameter to allow overriding the\ndefault encoding of ibm437 for file names, which was mainly\nused by DOS and still is the `default on Linux <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/fat/Kconfig?h=v5.10#n81>`_.\n\nAny encoding known by Python can be used as value for this\nparameter, but keep in mind that this might affect interoperability\nwith other systems, especially when the selected encoding/codepage\nis not native or supported.\n\nPlease note that this only affects encoding of the 8DOT3 short file names, not\nlong file names of the VFAT extension, as LFN are always stored as UTF-16-LE.\n\n.. code-block:: python\n\n   import fs\n   my_fs = fs.open_fs(\"fat:///dev/sda1?encoding=cp1252\")\n\n\noffset\n^^^^^^\n\nSpecify an offset in bytes to skip when accessing the file. That way even\ncomplete disk images can be read if the location of the partition is known:\n\n.. code-block:: python\n\n   import fs\n   my_fs = fs.open_fs(\"fat:///dev/sda?offset=32256\")\n\n\npreserve_case\n^^^^^^^^^^^^^\n\nPreserve case when creating files. This will force LFN entries for all\ncreated files that do not match the 8DOT3 rules. This defaults to ``true``\nbut can be disabled by setting preserve_case to ``false``:\n\n.. code-block:: python\n\n   import fs\n   my_fs = fs.open_fs(\"fat:///dev/sda1?preserve_case=false\")\n\n\nread_only\n^^^^^^^^^\n\nOpen filesystem in read-only mode and thus don't allow writes/modifications.\nThis defaults to false but can be enabled by setting read_only to ``true``:\n\n.. code-block:: python\n\n   import fs\n   my_fs = fs.open_fs(\"fat:///dev/sda1?read_only=true\")\n\n\nutc\n^^^\n\nCreate all timestamps on the filesystem in UTC time rather than local time.\nAffects all directory entries' creation, modification and access times.\n\n.. code-block:: python\n\n    import fs\n    my_fs = fs.open_fs(\"fat:///dev/sda1?utc=true\")\n\n\nlazy_load\n^^^^^^^^^\n\nIf set to ``true`` (default), the directory entries are loaded only when accessed\nto increase performance with larger filesystems and resilience against\nrecursion / directory loops.\n\n.. code-block:: python\n\n    import fs\n    my_fs = fs.open_fs(\"fat:///dev/sda1?lazy_load=false\")\n.. pyfilesystem-quickstart-end\n\nTesting\n-------\n\nTests are located at the `tests` directory. In order to test your new\ncontribution to pyfatfs just run\n\n.. code-block:: bash\n\n    $ python setup.py test\n\nfrom your shell.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2018-2024 pyfatfs contributors  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "FAT12/FAT16/FAT32 implementation with VFAT support",
    "version": "1.1.0",
    "project_urls": {
        "Changelog": "https://github.com/nathanhi/pyfatfs/blob/master/CHANGELOG.rst",
        "Documentation": "https://pyfatfs.readthedocs.io",
        "Homepage": "https://github.com/nathanhi/pyfatfs",
        "Issues": "https://github.com/nathanhi/pyfatfs/issues",
        "Source": "https://github.com/nathanhi/pyfatfs"
    },
    "split_keywords": [
        "filesystem",
        "pyfilesystem2",
        "fat12",
        "fat16",
        "fat32",
        "vfat",
        "lfn"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cbdefeb531b25eb2315aa73a7dba335c253ee0075ff7f55b6fe742fb6d492ade",
                "md5": "403c665c96b4b5ab7ea1f97f4c8850d2",
                "sha256": "7401fd39d9e92f531b2abea5b5d1d2c19d5461f4ba9ce8819b1ba35aea73c65d"
            },
            "downloads": -1,
            "filename": "pyfatfs-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "403c665c96b4b5ab7ea1f97f4c8850d2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.8",
            "size": 37932,
            "upload_time": "2024-03-03T20:50:41",
            "upload_time_iso_8601": "2024-03-03T20:50:41.426853Z",
            "url": "https://files.pythonhosted.org/packages/cb/de/feb531b25eb2315aa73a7dba335c253ee0075ff7f55b6fe742fb6d492ade/pyfatfs-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "443fd08f1dbc44a7eef9c7fb355b83423fbd15bb3e487c250479a2c179cb39bf",
                "md5": "df7f61cdec5567ec16956cbae14514e0",
                "sha256": "9725ccd0a4da1c09c27358abbf10f08c043ac84210af576803e087f51a2b30e0"
            },
            "downloads": -1,
            "filename": "pyfatfs-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "df7f61cdec5567ec16956cbae14514e0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 55459,
            "upload_time": "2024-03-03T20:50:43",
            "upload_time_iso_8601": "2024-03-03T20:50:43.227522Z",
            "url": "https://files.pythonhosted.org/packages/44/3f/d08f1dbc44a7eef9c7fb355b83423fbd15bb3e487c250479a2c179cb39bf/pyfatfs-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-03 20:50:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nathanhi",
    "github_project": "pyfatfs",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyfatfs"
}
        
Elapsed time: 0.19304s