File Storage API
Installing
To install library run:
npm i @deepvision/fs.js
Initializing
For working using api library import to your script file
and create instance with new
. Notice, that endpoint
argument is required in constructor.
import FSApi from '<path_to_library>';
const fsApi = new FSApi({
endpoint: 'your-enpoint',
getAccessToken: auth.getAccessToken,
});
Usage
File Types
- image.course.cover
Upload File
Upload original image to the server
fsApi.files.upload(file, {
org: 'org-id'
})
- file – instance of FormData
Upload Original Image
Upload original image to the server
fsApi.images.upload(file, {
type: 'file-type',
org: 'org-id'
})
- file – instance of FormData
Upload Cropped Image
Upload cropped image to the server
fsApi.images.upload(file, {
type: 'file-type',
parentId: 'parent-id',
cropMask: 'x,y,h,w', // '12,345,22,65',
org: 'org-id',
})
- file – instance of FormData
Get validation rules
Validation rules for file type
fsApi.validationRules(fileType)
- fileType – type of transferred file
License
This project is licensed under the DeepVision License