{"id":21654633,"url":"https://github.com/localvoid/py-filespy","last_synced_at":"2025-03-20T04:42:07.632Z","repository":{"id":57429439,"uuid":"9386807","full_name":"localvoid/py-filespy","owner":"localvoid","description":null,"archived":false,"fork":false,"pushed_at":"2013-06-12T05:17:49.000Z","size":128,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-25T06:25:20.082Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/localvoid.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-12T04:48:31.000Z","updated_at":"2013-10-01T01:28:19.000Z","dependencies_parsed_at":"2022-08-27T17:01:07.271Z","dependency_job_id":null,"html_url":"https://github.com/localvoid/py-filespy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localvoid%2Fpy-filespy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localvoid%2Fpy-filespy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localvoid%2Fpy-filespy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localvoid%2Fpy-filespy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/localvoid","download_url":"https://codeload.github.com/localvoid/py-filespy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244554121,"owners_count":20471173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T08:28:30.142Z","updated_at":"2025-03-20T04:42:07.611Z","avatar_url":"https://github.com/localvoid.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"=========\n filespy\n=========\n\n.. image:: https://travis-ci.org/localvoid/py-filespy.png?branch=master\n\nFileSpy is a simple library that helps you detect filesystem changes.\n\n\nAPI\n===\n\nCHANGE_TYPE\n-----------\n\n``CREATED = 0``\n\n``DELETED = 1``\n\n``MODIFIED = 2``\n\nmake_snapshot\n-------------\n\n``make_snapshot(path, followlinks=False) -\u003e dict()``\n\n``path`` - directory path\n\n``followlinks=False`` - follow links when traversing through directory\n\nCreates a directory snapshot. Snapshot doesn't hold any information\nabout directory in which this snapshot was done, so you can easily\ncompare directories in a different locations.\n\nIt returns a simple dictionary, where keys is a file path and value is\nos.stat() of this file. It is done in a such way to make serialization\nof this data as simple as possible.\n\nsnapshot_diff\n-------------\n\n``snapshot_diff(s1, s2) -\u003e tuple(CHANGE_TYPE, path)``\n\nGenerator that yields changes between two snapshots.\n\n\nExample\n=======\n\n.. code:: python\n\n    s1 = filespy.make_snapshot('/dir')\n    time.sleep(3)\n    s2 = filespy.make_snapshot('/dir')\n    for t, path in filespy.snapshot_diff(s1, s2):\n        if t == filespy.CREATED:\n            on_create(path)\n        elif t == filespy.DELETED:\n            on_delete(path)\n\nHere we are taking snapshot of the directory ``/dir``, then sleep for\n3 seconds, take another snapshot, and finally looking at the changes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalvoid%2Fpy-filespy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocalvoid%2Fpy-filespy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalvoid%2Fpy-filespy/lists"}