PyBetterFileIO


NamePyBetterFileIO JSON
Version 1.0.8 PyPI version JSON
download
home_pagehttps://github.com/keithhb33/PyBetterFileIO
SummaryA faster, more efficient Python file input and output framework
upload_time2024-06-25 19:50:50
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")
```

            

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/81/ce/18eb01a6c64a9dda8e763f25acad045db92bb06fe1d106c5245f45ba0206/PyBetterFileIO-1.0.8.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",
    "bugtrack_url": null,
    "license": "NCSA",
    "summary": "A faster, more efficient Python file input and output framework",
    "version": "1.0.8",
    "project_urls": {
        "Download": "https://github.com/keithhb33/PyBetterFileIO/archive/refs/tags/v1.0.8.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": "81ce18eb01a6c64a9dda8e763f25acad045db92bb06fe1d106c5245f45ba0206",
                "md5": "de2b190225f913672a774b2c89366c1d",
                "sha256": "3e6d9d2393f9868da6d89b3bd5eaba685288630d762a20fc360a92de2467324d"
            },
            "downloads": -1,
            "filename": "PyBetterFileIO-1.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "de2b190225f913672a774b2c89366c1d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7410,
            "upload_time": "2024-06-25T19:50:50",
            "upload_time_iso_8601": "2024-06-25T19:50:50.104439Z",
            "url": "https://files.pythonhosted.org/packages/81/ce/18eb01a6c64a9dda8e763f25acad045db92bb06fe1d106c5245f45ba0206/PyBetterFileIO-1.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-25 19:50:50",
    "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: 0.28563s