@jaypy.code/upload-sdk

Warning: It is working for my upload server; So if you have upload server (codes or API) it is working for you.

Usage no npm install needed!

<script type="module">
  import jaypyCodeUploadSdk from 'https://cdn.skypack.dev/@jaypy.code/upload-sdk';
</script>

README

Upload SDK - V1.0.0

Warning: It is working for my upload server; So if you have upload server (codes or API) it is working for you.

Installation

There are many ways to download this package.

  1. Clone package from GITLAB:
git clone https://gitlab.com/jaypy.code/upload-sdk.git
  1. Use NPM:
npm i @jaypy.code/upload-sdk
  1. Use Yarn:
yarn add @jaypy.code/upload-sdk

How to import package

After you download and install this package, you can use this package in WEB BROWSERS.

  1. Webpack:
const UPLOAD = require('@jaypy.code/upload-sdk');
  1. HTML Tag:
<script src="/path/to/go/main.js"></script>

How to use

It is easy to use. You just need ENDPOINT ( upload server url ) and ACCESS TOKEN ( User access token to upload file ).

const upload = new UPLOAD('ENDPOINT', 'ACCESS TOKEN');


    // YOUR CODES


/**
 * Upload A File
 * Action: Open file dialog and User select a file then starting upload the file and return all results
 * @param {String} folder Upload file to folder
 * @param {Array | String} formats File formats (Example: ['image/png'] or "image/jpeg")
 * @returns {Boolean} status - Upload done successfully or not.
 * @returns {String} message
 * @returns {String} file - If status be true, this is file path in server. 
 */

upload.send('FOLDER NAME', [])
    .then(result=>{
        let status = result['status'];
        let message = result['message'];
        let file = result['file'];

        // YOUR CODES

    })
    .catch(error=>{
        // YOUR CODES
    });


    // YOUR CODES