# file-system
**Repository Path**: edgegallery/file-system
## Basic Information
- **Project Name**: file-system
- **Description**: No description available
- **Primary Language**: Go
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 1
- **Forks**: 11
- **Created**: 2021-05-24
- **Last Updated**: 2024-05-16
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# EdgeGallery file-system
## Overview
As a middleware, the file system provides file management services for uploading, downloading, querying, and deleting worked for multiple modules. The image file slimming function is added in v1.3
## Detailed introduction
- upload
The image file itself can be selected for uploading the file. If the image file is too large, it is recommended to compress it into a zip file for uploading, or it is recommended to upload it in pieces. When uploading zip, the .qcow2 file needs to be compressed in the folder.
- download
Different formats can be selected when downloading files according to imageId, which can be controlled by QUERY parameters
- query
Query file details based on imageId
- delete
Delete stored files and data information according to imageId
- Slim
Call the imageops function of another container in the same pod to assist in the image slimming operation. The specific flow chart is as follows:

## API Definition
| | Method | URL | form-data | Response | API Instruction |
| ------------------- | :----: | ----------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| upload | POST | /image-management/v1/images | userId: the ID of user
file: chosen file
priority: Storage priority | {
imageId:"string"
fileName:"string"
uploadTime:"string"
userId:"string"
storageMedium:"string"
msg:"string"
checkStatus:int
slimStatus:int
} | slimStatus:[0,1,2,3]stands for Not slimmed yet / slimming down / success / failure
Optional upload image file format:.zip/.qcow2/.img/.iso, ;
***priority*** generally select 0;When uploading the zip, the upper layer of the image file should be wrapped with a layer of folders |
| download | GET | /image-management/v1/images/{imageId}/action/download | None | file | The format of the download image file is optional. When the query is /?isZip=true, the download format is .zip; when the query is not included, the image file itself is downloaded |
| query | GET | /image-management/v1/images/{imageId} | None | {imageId:"string"
file:"string"
uploadTime:"string"
userId:"string"
storageMedium:"string"} | Query file details based on imageId |
| delete | DELETE | /image-management/v1/images/{imageId} | None | 删除成功: delete success/
删除失败: error | Delete local files based on imageId |
| slim | POST | /image-management/v1/images/{imageId}/action/slim | None | compress in progress/
compress failed | Compress the image file according to ImageID |
| upload chunk | POST | /image-management/v1/images/upload | identifier: file identification
part: chunk file.part
priority: Storage priority | ok | This API only accepts the upload of one file chunk, which is stored in the system according to the identifier |
| cancel upload chunk | DELETE | /image-management/v1/images/upload | identifier: file identification
priority: Storage priority | 取消成功:cancel success/
取消失败:error | Canceling will delete the uploaded chunk file. |
| merge chunk | POST | /image-management/v1/images/merge | identifier: file identification
userId: the ID of user
filename: name for merged file
priority: Storage priority | {
imageId:"string"
fileName:"string"
uploadTime:"string"
userId:"string"
storageMedium:"string"
msg:"string"
checkStatus:int
slimStatus:int
} | slimStatus:[0,1,2,3]stands for Not slimmed yet / slimming down / success / failure
filename: fill in with original file name which format can be zip or .qcow2/.iso/.img |