PyBetterFileIO


NamePyBetterFileIO JSON
Version 1.0.9 PyPI version JSON
download
home_pagehttps://github.com/keithhb33/PyBetterFileIO
SummaryA faster, more efficient Python file input and output framework
upload_time2024-06-28 16:54:35
maintainerNone
docs_urlNone
authorKeith Burroughs
requires_pythonNone
licenseNCSA
keywords python files file folder folders input output fileio file management script
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <a name="readme-top"></a>


<br />
<div align="center">

  <h3 align="center">PyBetterFileIO</h3>

  <p align="center">A faster, more efficient Python file input and output framework</p>
</div>


<!-- TABLE OF CONTENTS -->

<h3>Table of Contents</h3>
<ol>
  <li>
    <a href="#about-the-project">About The Project</a>
  </li>
  <li>
    <a href="#installation">Installation</a></li>
  </li>
  <li>
    <a href="#usage">Usage</a>
  </li>
  <li>
    <a href="#making-a-file">Default Python vs. PyBetterFileIO</a>
  </li>
</ol>




<!-- ABOUT THE PROJECT -->
## About The Project

<p>PyBetterFileIO is the most intuitive, efficient, and accessible way to perform file input and output functions in python.
Designed to improve the syntax of Python's included libraries, PyBetterFileIO is an effective tool.
Create and edit files and folders, copy and move files and directories, and more.
Treat your files and directories like objects in Python.</p>




### Installation
```bash
pip install PyBetterFileIO
```

## Usage
```python
from PyBetterFileIO import *
```
## Functions and Implementation

<h2>File Commands</h2>

```python
new_file = file("new_file.txt") # Instantiate a file object (required!)
```
```python
new_file.make() # Make the file in the defined directory
new_file.create() # Create the file in the defined directory
```
```python
new_file.write("Hello World!") # Clears and writes to file's content
```
```python
new_file.append(" It's a beautiful day.") # Adds onto file's existing content
```
```python
new_file.replace("Hello World!", "Goodbye World!") # Finds and replaces file's content
```
```python
new_file.move_to("folder_or_path_to_move_to.optional") # Moves file to specified location
```
```python
new_file.rename("folder_to_move_to/old_file.txt") # Rename the file
```
```python
new_file.delete() # Delete the file
new_file.remove() # Remove the file
```
```python
new_file.copy("test_folder/fun_file.txt") # Copy file to parameter's location
new_file.copy_and_rename("test_folder/fun_file.txt") # Copy file to parameter's location
new_file.copy_to("test_folder/fun_file.txt") # Copy file to parameter's location
```
```python
new_file.read() # Returns file text content
```
```python
new_file.print() # Prints file text content
```
```python
new_file.exists() # Returns boolean if file exists
```
```python
new_file.get_filename() # Returns file's path
```
```python
new_file.get_default_file_object() # Returns a default file object allowing new_file to act as: with open(...) as new_file:
```
```python
new_file.get_custom_file_object() # Returns a PyBetterFileIO file object from a default object where default is from: with open(...) as new_file
```

<h2>Folder Commands</h2>

```python
new_folder = folder("new_folder") # Instantiate a folder object (required!)
```
```python
new_folder.make() # Make the file in the defined directory
new_folder.create() # Create the file in the defined directory
```
```python
new_folder.replace("not_needed_folder") # Replaces content of parameter's folder with object's content
```
```python
new_folder.rename("folder_to_move_to/old_file.txt") # Rename the file
```
```python
new_folder.delete() # Delete the file
new_folder.remove() # Remove the file
```
```python
new_folder.create_file("name_of_file.txt") # Create a file inside folder
new_folder.make_file("name_of_file.txt") # Make a file inside folder
```
```python
new_folder.copy_to("test_folder") # Copy folder to parameter's location
new_folder.copy_contents_to("test_folder") # Copy contents to parameter's location
```
```python
new_folder.move_to("test_folder") # Moves to parameter's location without keeping original directory
```
```python
new_folder.list() # Returns a list of all files in folder object
```
```python
new_folder.read() # Returns file text content
```
```python
new_folder.print() # Prints file text content
```
```python
new_folder.exists() # Returns boolean if folder exists
```
```python
new_folder.clear() # Clears folder content
```
```python
new_folder.get_foldername() # Returns file's path
```

<h4>Static Method</h4>

```python
Folder.clear_at("directory") # Clears specified directory
```

## Default Python vs. PyBetterFileIO
<h2 id="making-a-file">Making a File</h2>

<h3>Default Python</h3>

```python
with open("file.txt", 'w') as file:
  file.write()
```

<h3>PyBetterFileIO</h3>

```python
file("file.txt").make()
```

<h2>Writing to a file</h2>

<h3>Default Python</h3>

```python
with open("file.txt", "w") as file:
  file.write("Hello World!")
```

<h3>PyBetterFileIO</h3>

```python
file("file.txt").write("Hello World!")
```

<h2>Replacing text in a file</h2>

<h3>Default Python</h3>

```python
# Assume already existing file
with open('file.txt', 'r') as file:
  filedata = file.read()

filedata = filedata.replace('abcd', 'ram')

with open('file.txt', 'w') as file:
  file.write(filedata)
```

<h3>PyBetterFileIO</h3>

```python
file("file.txt").replace("abcd", "ram")
```

<h2>Copy Contents of a Folder</h2>

<h3>Default Python</h3>

```python
files = os.listdir("contents")
for file in files:
  shutil.copy(os.path.join("contents", file), os.path.join("other_content", "test_folder", file))
```

<h3>PyBetterFileIO</h3>

```python
folder("contents").copy_contents_to("other_content/test_folder")
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/keithhb33/PyBetterFileIO",
    "name": "PyBetterFileIO",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "python, files, file, folder, folders, input, output, fileio, file management, script",
    "author": "Keith Burroughs",
    "author_email": "keithburroughs33@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/18/39/6314251158d17ba1baab2a44390ecf143c53ca652cbaea636afd38aad72e/PyBetterFileIO-1.0.9.tar.gz",
    "platform": null,
    "description": "<a name=\"readme-top\"></a>\r\n\r\n\r\n<br />\r\n<div align=\"center\">\r\n\r\n  <h3 align=\"center\">PyBetterFileIO</h3>\r\n\r\n  <p align=\"center\">A faster, more efficient Python file input and output framework</p>\r\n</div>\r\n\r\n\r\n<!-- TABLE OF CONTENTS -->\r\n\r\n<h3>Table of Contents</h3>\r\n<ol>\r\n  <li>\r\n    <a href=\"#about-the-project\">About The Project</a>\r\n  </li>\r\n  <li>\r\n    <a href=\"#installation\">Installation</a></li>\r\n  </li>\r\n  <li>\r\n    <a href=\"#usage\">Usage</a>\r\n  </li>\r\n  <li>\r\n    <a href=\"#making-a-file\">Default Python vs. PyBetterFileIO</a>\r\n  </li>\r\n</ol>\r\n\r\n\r\n\r\n\r\n<!-- ABOUT THE PROJECT -->\r\n## About The Project\r\n\r\n<p>PyBetterFileIO is the most intuitive, efficient, and accessible way to perform file input and output functions in python.\r\nDesigned to improve the syntax of Python's included libraries, PyBetterFileIO is an effective tool.\r\nCreate and edit files and folders, copy and move files and directories, and more.\r\nTreat your files and directories like objects in Python.</p>\r\n\r\n\r\n\r\n\r\n### Installation\r\n```bash\r\npip install PyBetterFileIO\r\n```\r\n\r\n## Usage\r\n```python\r\nfrom PyBetterFileIO import *\r\n```\r\n## Functions and Implementation\r\n\r\n<h2>File Commands</h2>\r\n\r\n```python\r\nnew_file = file(\"new_file.txt\") # Instantiate a file object (required!)\r\n```\r\n```python\r\nnew_file.make() # Make the file in the defined directory\r\nnew_file.create() # Create the file in the defined directory\r\n```\r\n```python\r\nnew_file.write(\"Hello World!\") # Clears and writes to file's content\r\n```\r\n```python\r\nnew_file.append(\" It's a beautiful day.\") # Adds onto file's existing content\r\n```\r\n```python\r\nnew_file.replace(\"Hello World!\", \"Goodbye World!\") # Finds and replaces file's content\r\n```\r\n```python\r\nnew_file.move_to(\"folder_or_path_to_move_to.optional\") # Moves file to specified location\r\n```\r\n```python\r\nnew_file.rename(\"folder_to_move_to/old_file.txt\") # Rename the file\r\n```\r\n```python\r\nnew_file.delete() # Delete the file\r\nnew_file.remove() # Remove the file\r\n```\r\n```python\r\nnew_file.copy(\"test_folder/fun_file.txt\") # Copy file to parameter's location\r\nnew_file.copy_and_rename(\"test_folder/fun_file.txt\") # Copy file to parameter's location\r\nnew_file.copy_to(\"test_folder/fun_file.txt\") # Copy file to parameter's location\r\n```\r\n```python\r\nnew_file.read() # Returns file text content\r\n```\r\n```python\r\nnew_file.print() # Prints file text content\r\n```\r\n```python\r\nnew_file.exists() # Returns boolean if file exists\r\n```\r\n```python\r\nnew_file.get_filename() # Returns file's path\r\n```\r\n```python\r\nnew_file.get_default_file_object() # Returns a default file object allowing new_file to act as: with open(...) as new_file:\r\n```\r\n```python\r\nnew_file.get_custom_file_object() # Returns a PyBetterFileIO file object from a default object where default is from: with open(...) as new_file\r\n```\r\n\r\n<h2>Folder Commands</h2>\r\n\r\n```python\r\nnew_folder = folder(\"new_folder\") # Instantiate a folder object (required!)\r\n```\r\n```python\r\nnew_folder.make() # Make the file in the defined directory\r\nnew_folder.create() # Create the file in the defined directory\r\n```\r\n```python\r\nnew_folder.replace(\"not_needed_folder\") # Replaces content of parameter's folder with object's content\r\n```\r\n```python\r\nnew_folder.rename(\"folder_to_move_to/old_file.txt\") # Rename the file\r\n```\r\n```python\r\nnew_folder.delete() # Delete the file\r\nnew_folder.remove() # Remove the file\r\n```\r\n```python\r\nnew_folder.create_file(\"name_of_file.txt\") # Create a file inside folder\r\nnew_folder.make_file(\"name_of_file.txt\") # Make a file inside folder\r\n```\r\n```python\r\nnew_folder.copy_to(\"test_folder\") # Copy folder to parameter's location\r\nnew_folder.copy_contents_to(\"test_folder\") # Copy contents to parameter's location\r\n```\r\n```python\r\nnew_folder.move_to(\"test_folder\") # Moves to parameter's location without keeping original directory\r\n```\r\n```python\r\nnew_folder.list() # Returns a list of all files in folder object\r\n```\r\n```python\r\nnew_folder.read() # Returns file text content\r\n```\r\n```python\r\nnew_folder.print() # Prints file text content\r\n```\r\n```python\r\nnew_folder.exists() # Returns boolean if folder exists\r\n```\r\n```python\r\nnew_folder.clear() # Clears folder content\r\n```\r\n```python\r\nnew_folder.get_foldername() # Returns file's path\r\n```\r\n\r\n<h4>Static Method</h4>\r\n\r\n```python\r\nFolder.clear_at(\"directory\") # Clears specified directory\r\n```\r\n\r\n## Default Python vs. PyBetterFileIO\r\n<h2 id=\"making-a-file\">Making a File</h2>\r\n\r\n<h3>Default Python</h3>\r\n\r\n```python\r\nwith open(\"file.txt\", 'w') as file:\r\n  file.write()\r\n```\r\n\r\n<h3>PyBetterFileIO</h3>\r\n\r\n```python\r\nfile(\"file.txt\").make()\r\n```\r\n\r\n<h2>Writing to a file</h2>\r\n\r\n<h3>Default Python</h3>\r\n\r\n```python\r\nwith open(\"file.txt\", \"w\") as file:\r\n  file.write(\"Hello World!\")\r\n```\r\n\r\n<h3>PyBetterFileIO</h3>\r\n\r\n```python\r\nfile(\"file.txt\").write(\"Hello World!\")\r\n```\r\n\r\n<h2>Replacing text in a file</h2>\r\n\r\n<h3>Default Python</h3>\r\n\r\n```python\r\n# Assume already existing file\r\nwith open('file.txt', 'r') as file:\r\n  filedata = file.read()\r\n\r\nfiledata = filedata.replace('abcd', 'ram')\r\n\r\nwith open('file.txt', 'w') as file:\r\n  file.write(filedata)\r\n```\r\n\r\n<h3>PyBetterFileIO</h3>\r\n\r\n```python\r\nfile(\"file.txt\").replace(\"abcd\", \"ram\")\r\n```\r\n\r\n<h2>Copy Contents of a Folder</h2>\r\n\r\n<h3>Default Python</h3>\r\n\r\n```python\r\nfiles = os.listdir(\"contents\")\r\nfor file in files:\r\n  shutil.copy(os.path.join(\"contents\", file), os.path.join(\"other_content\", \"test_folder\", file))\r\n```\r\n\r\n<h3>PyBetterFileIO</h3>\r\n\r\n```python\r\nfolder(\"contents\").copy_contents_to(\"other_content/test_folder\")\r\n```\r\n",
    "bugtrack_url": null,
    "license": "NCSA",
    "summary": "A faster, more efficient Python file input and output framework",
    "version": "1.0.9",
    "project_urls": {
        "Download": "https://github.com/keithhb33/PyBetterFileIO/archive/refs/tags/v1.0.9.tar.gz",
        "Homepage": "https://github.com/keithhb33/PyBetterFileIO"
    },
    "split_keywords": [
        "python",
        " files",
        " file",
        " folder",
        " folders",
        " input",
        " output",
        " fileio",
        " file management",
        " script"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "18396314251158d17ba1baab2a44390ecf143c53ca652cbaea636afd38aad72e",
                "md5": "796c2f68f1d546c89f494de1647746db",
                "sha256": "f3fbce1859e707e723ffc3b0aa290e49aa3e93d12d2e9cb94790e531cbc321d3"
            },
            "downloads": -1,
            "filename": "PyBetterFileIO-1.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "796c2f68f1d546c89f494de1647746db",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7554,
            "upload_time": "2024-06-28T16:54:35",
            "upload_time_iso_8601": "2024-06-28T16:54:35.452352Z",
            "url": "https://files.pythonhosted.org/packages/18/39/6314251158d17ba1baab2a44390ecf143c53ca652cbaea636afd38aad72e/PyBetterFileIO-1.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-28 16:54:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "keithhb33",
    "github_project": "PyBetterFileIO",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pybetterfileio"
}
        
Elapsed time: 9.39929s