1.0.2 ā€¢ Published 9 days ago

filemanagementsystemfornode v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
9 days ago

šŸ“˜ File Management System - TypeScript

A powerful, flexible, and chainable file management system for Node.js.

šŸ“˜ File Management System - TypeScript

A powerful, flexible, and chainable file management system for Node.js.
This system provides an easy way to manage files and directories while supporting:

  • Custom error handling
  • Custom chainable methods
  • Advanced file operations like compression, metadata retrieval, and content manipulation.

šŸ“Œ Key Features

šŸš€ File Operations

āœ” Rename, Move, Copy, and Delete files
āœ” Append content to files
āœ” Retrieve compressed file content (getInfo())
āœ” Retrieve file metadata (getMetaInfo())

šŸ“‚ Directory Operations

āœ” Create, Delete, and List directories
āœ” Check if a file/folder exists (syncExist())

āš™ Customization & Error Handling

āœ” Custom error handling (e.g., auto-create missing files on error)
āœ” Add custom chainable methods (addMethod())
āœ” Invoke custom chain methods dynamically (invokeMethod())


šŸ“„ Installation

To install and use this package, run:

git clone https://github.com/Whitzzscott/FileManagement.git
cd FileManagement
npm install

šŸ›  Usage Example

This example demonstrates:

  • Error handling: Automatically creating a missing file if an error occurs.
  • Custom chainable methods: Adding a method that logs the file path.
  • File operations: Renaming, moving, copying, appending, and deleting a file.
import { FileWrapper } from "./wrappers/FileWrapper";

const file = new FileWrapper("./testFolder/sample.txt");

// āœ… Custom error handling: Auto-create missing files when they are not found
file.errorOnFound = (error) => {
    if (error.code === "ENOENT") {
        file.sync().writeFile("Default content");
        console.log(`šŸ“„ File created: ${file.getPath()}`);
    }
};

// āœ… Add a custom method (e.g., logging the file path)
file.addMethod("logPath", function () {
    console.log("File is at:", this.getPath());
    return this;
});

// āœ… Chainable file operations
(async () => {
    file
        .rename("renamed.txt")  // Renames file
        .invokeMethod("logPath") // Logs new file path
        .move("./testFolder/moved") // Moves file to a new folder
        .copy("./backup")  // Creates a copy in the backup folder
        .append("\nMore content added.") // Appends text to the file
        .delete();  // Deletes the file

    console.log("šŸ“„ Compressed File Content:", file.getInfo());
    console.log("šŸ“‘ File Metadata:", file.getMetaInfo());
    console.log("šŸ“‚ Files in directory:", file.list());
})();

šŸ“œ API Reference

This file management system offers multiple operations for handling files and folders.

šŸ“‚ File Operations

MethodDescriptionExample
rename(newName: string)Renames the filefile.rename("newName.txt")
move(destination: string)Moves the file to a new directoryfile.move("./newFolder")
copy(destination: string)Copies the file to a new locationfile.copy("./backup")
delete()Deletes the file permanentlyfile.delete()
writeFile(content: string)Writes new content to the file (overwrites existing content)file.writeFile("Hello, world!")
append(content: string)Appends new content to the filefile.append("\nNew content")

šŸ“ Directory Operations

MethodDescriptionExample
syncExist()Checks if a file or folder existsif (file.syncExist()) {...}
sync()Ensures the directory exists (creates it if missing)file.sync()
list()Lists all files in the directoryconsole.log(file.list())

šŸ“Š File Info & Metadata

MethodDescriptionExample
getInfo()Reads and compresses the entire file contentconsole.log(file.getInfo())
getMetaInfo()Retrieves metadata such as size, creation date, and modification dateconsole.log(file.getMetaInfo())

āš™ Customization & Error Handling

MethodDescriptionExample
errorOnFound = (error) => {...}Custom error handling (e.g., auto-create files)file.errorOnFound = (err) => {...}
addMethod(name, method)Adds a custom chainable methodfile.addMethod("customMethod", function () {...})
invokeMethod(name, ...args)Calls a custom method dynamicallyfile.invokeMethod("customMethod")

šŸ”§ How to Use This Project

  1. Install the package
    npm install filemanagementsystemfornode
  2. Run the script
    npm run start
  3. Modify settings
    • Change file paths in src/main.ts to test different operations.
    • Modify core functionality in src/Wrapper if necessary.

šŸ“œ License

This project is open-source and free to use.


šŸ’” Future Enhancements

We plan to add:

  • šŸ”¹ File encryption support (AES, RSA encryption for file security)
  • šŸ”¹ File versioning (track changes over time)
  • šŸ”¹ Logging & monitoring system (track operations in a log file)

šŸš€ Enjoy simplified file management with powerful chaining!
Feel free to suggest new features or improvements! šŸŽÆ


šŸ‘Øā€šŸ’» Author

WhitzScott - Developer of the File Management System.
If you have questions or ideas, feel free to reach out!

typescriptnodejsfile-managementfile-operationsfilesystemfile-utilitiesfile-wrappercustom-error-handlingerror-handlingrename-filemove-filecopy-filedelete-fileappend-contentget-file-infoget-file-metadatadirectory-managementlist-fileslist-directoriesrecursive-directory-listingcheck-file-existencecreate-directorydelete-directorywrite-fileread-filefile-permissionsfile-lockingtemporary-filesfile-synchronizationdata-compressionzip-filesunzip-filestar-filesgzip-filesdecompress-filesencryptiondecryptionAES-encryptionRSA-encryptionsecure-file-storagefile-checksumhashingintegrity-checkversioningfile-backupsrestore-filesdisk-space-analysislarge-file-handlingparallel-file-processingbatch-file-operationsstreaming-filesfile-chunkingmerge-filessplit-fileslog-file-managementconfig-file-managementdata-parsingJSON-file-handlingCSV-file-processingXML-file-processingYAML-file-handlingbinary-file-handlingmetadata-parsingtimestamp-retrievalautomatic-renamingfile-classificationmachine-learning-file-managementintelligent-searchdeep-learning-file-organizationOCR-integrationcontext-aware-file-operationspredictive-file-managementsemantic-searchdata-indexingdocument-managemententerprise-document-storagedigital-asset-managementfile-clusteringgraph-based-file-navigationblockchain-file-storageIPFS-integrationdecentralized-storagezero-knowledge-storageedge-computing-file-storageserverless-file-handlingmulti-platform-supportcross-device-syncremote-file-accesscloud-storageAWS-S3-integrationGoogle-Drive-integrationDropbox-file-syncOneDrive-integrationreal-time-file-collaborationaudit-loggingfile-monitoringsystem-loggingenterprise-securityGDPR-complianceHIPAA-compliancerole-based-accessauthenticationtoken-based-accessfile-permission-controlmulti-threaded-file-processingbig-data-file-storagescientific-data-storagefinancial-records-managementmedical-records-storagelegal-document-managementimage-processingvideo-file-handlingaudio-file-managementmedia-file-organizationgame-development-assets3D-model-file-storagemetadata-driven-automationself-healing-filesystemcloud-native-file-storagereal-time-indexingAI-assisted-file-organizationsmart-file-taggingvoice-search-filesnatural-language-file-searchevent-driven-file-managementfile-change-detectionreal-time-backupincremental-backupsdisaster-recoverycustomizable-file-rulesworkflow-automationlegal-compliancedocument-signingcertified-backupsdata-lifecycle-managementIoT-data-storagehigh-performance-storagelow-latency-file-operationsGPU-accelerated-file-processingquantum-safe-storagedata-governancepredictive-maintenanceautomated-file-classificationcognitive-file-organizationstorage-analyticsdisk-cleanupfile-defragmentationdistributed-file-storagecollaborative-editingworkflow-managementcorporate-file-strategyAI-powered-file-retrievalpersonalized-file-organizationdigital-rights-managementsecure-document-storageAI-data-lakescontent-addressable-storagequantum-computing-file-managementnext-gen-filesystemsAI-assisted-searchsemantic-file-retrievalsmart-folder-creationmetadata-enrichmentfile-recommendation-systemssmart-file-prioritizationauto-scaling-storagecloud-redundancyserverless-cloud-backupsbackup-automationblock-level-storageflash-storage-managementdatabase-file-storagehybrid-cloud-storagesecure-P2P-file-sharingenterprise-file-distributionnetwork-file-transferdeduplicationreal-time-stream-processinginteractive-data-visualizationfile-query-engineindexing-engineclustered-file-storageautomated-taggingdeep-learning-file-classificationcontext-aware-storageself-organizing-file-systemreal-time-metadata-extractioncognitive-searchprivacy-preserving-file-storagefederated-learning-file-managementprivacy-preserving-file-accesscontent-based-file-searchAI-driven-file-organizationunsupervised-file-clusteringfuzzy-file-searchsmart-content-deduplicationintelligent-content-archivingmachine-learning-data-processingexplainable-AI-file-managementnatural-language-processing-searchmulti-agent-file-managementadaptive-file-storagecontextual-file-retrievalmulti-cloud-storage-integrationquantum-encryption-for-filesAI-assisted-data-migrationsecure-data-erasurepolicy-driven-storageself-configuring-filesystemautomated-file-groupingdeep-metadata-analysisprivacy-centric-data-storageself-learning-file-systemsblockchain-secured-file-storagedigital-identity-file-securityAI-powered-cloud-storageautomated-document-taggingprivacy-enhanced-data-storagefederated-file-sharingopen-source-file-systemsintelligent-document-processingadaptive-access-controlsecure-data-synchronizationintelligent-duplicate-detectionlightweight-file-indexingpolicy-driven-file-accessdata-governance-frameworklarge-scale-data-indexingAI-powered-data-cleaninghigh-availability-storageAI-powered-file-trackingnext-gen-data-managementcontent-driven-file-navigationcross-domain-file-accessreal-time-digital-archivingedge-compute-storagesemantic-data-labelingcollaborative-cloud-file-storagemulti-user-file-editingdata-mesh-storagemodular-storage-architectureenterprise-asset-managementfederated-storage-networkscloud-native-data-protectioncomposable-file-systemscontainerized-file-storagereal-time-streaming-storage
1.0.2

9 days ago

1.0.1

9 days ago

1.0.0

9 days ago