Coder Social home page Coder Social logo

cloudstorage's Introduction

CloudStorage

Description

CloudStorage is a small pet project written in Node.js. This project enables users to upload and download files from a remote server. The server uses the local disk for storage. In this project, the issue of concurrent access to files is solved using the npm module "mutex-async".

What are the possibilities?

  • Retrieving a list of files from the server in JSON format
  • Uploading file(s) to the server using form-data
  • Downloading a specific file from the server
  • Deleting a specific file or an entire folder from the server

Installation

NOTE: Installation requires Node.js v19.9.0 or higher and npm v9.6.3 or higher.

  1. Download or clone the repository to your computer:
$ git clone https://github.com/DmitryMezhevich/UploadFiles.git
  1. Open the project folder in the terminal.
  2. Install all external npm dependencies:
$ npm install
  1. Start the application:
$ npm start

Demo Version

The CloudStorage application has also been deployed on a remote server as a pet project. You can make requests to the remote API using the following URL:

  url https://cloudstorage-02ii.onrender.com

IMPORTANT: The storage capacity of the remote server is limited as I'm using a free subscription for my pet project.

Constraint:

The maximum size of an uploaded file should not exceed 4 GB (if you plan to upload large files, I recommend installing the application on your local computer).

Requests

For making requests to the API, it is recommended to use Postman. Note: If you want to use the demo version, make sure to replace "localhost:3000/" with the "https://cloudstorage-02ii.onrender.com" in all requests.

  • Get a list of files in JSON format:
GET localhost:3000/files-management/orders

Example of a response from the server in JSON format:

[
   {
      "orderID": "100",
      "type": "directory",
      "children": [
            {
               "name": "1.png",
               "type": "file"
            }
      ]
   }
]
  • Uploading file(s) to the server using form-data:
POST localhost:3000/files-management/orders/{orderID}

Where orderID is the identification number of the folder where the file(s) will be stored. In the form-data, it is mandatory to specify the key under which the uploaded file is located. Example response from the server in JSON format:

{
    "description": "File(-s) was upload!"
}
  • Downloading a specific file:
GET localhost:3000/files-management/orders/{orderID}/files/{fileID}

Where orderID is the identification number of the folder where the file is located, and fileID is the name of the file.
Note: You can obtain the list of available files by making a request to retrieve the list of files: GET localhost:3000/API/listFiles.
The response will be the downloaded file.

  • Deleting a specific file or an entire folder:
DELETE localhost:3000/files-management/orders/{orderID}/files/{fileID}
DELETE localhost:3000/files-management/orders/{orderID}

Where orderID is the identification number of the folder where the file is located, and fileID is the name of the file.

Example of a response from the server in JSON format:

{
    "descripthin": "File: '1.png' has been remove!"
}

Modules used in the project:

  • express
  • async-mutex
  • formidable
  • path
  • fs
  • fs-extra

For questions and suggestions:

LinkedIn: Mezhevich Dmitry ๐Ÿ˜‰

cloudstorage's People

Contributors

dmitrymezhevich avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.