UNPKG

@masvio/uploader

Version:

A simple, lightweight library to easily share files using MASV

74 lines (49 loc) 1.79 kB
# MASV Web Uploader ## Installation ``` yarn add @masvio/uploader ``` ## Usage ### First Steps #### Getting set up with MASV Refer to the [MASV API Developer Documentation](https://developer.massive.io/masv-api/). Below is an example using the `Portals` feature 1. [Login](https://app.massive.io/login) or [Signup](https://app.massive.io/signup) at MASV 2. Follow the Documentation on [Uploading to Masv](https://developer.massive.io/masv-api/upload) 3. Create a Package - [Team Package](https://developer.massive.io/masv-api/upload/#a-team-package) - [More info](https://developer.massive.io/masv-api/packages/) **OR** - [Portal Package](https://developer.massive.io/masv-api/upload/#b-portal-package) - [More info](https://developer.massive.io/masv-api/portals/) ### Uploading Files #### Instantiate the Uploader Get a Package ID - `id` - and an Access Token - `access_token` - from one of the above methods. ```javascript import { Uploader } from '@masvio/uploader'; const uploader = new Uploader(id, access_token); ``` #### Retrieve Files An html input with the `type` attribute set to `file` will have a property titled `files` in the DOM ```html <input type="file" id="fileInput" /> ``` ```javascript const fileInput = document.getElementById('fileInput'); let files = []; fileInput.addEventListener('input', (event) => { for (let file of fileInput.files) { files.push({ id: 'test ID', file, path: '' }); } }); ``` #### Upload files ```javascript uploader.addFiles(...files); ``` --- > For more detailed information. Visit the [MASV Web Uploader](https://developer.massive.io/js-uploader/) documentation page