Giter Club home page Giter Club logo

binary-document-uploader's Introduction

binary-document-uploader

Uploading files through websocket to binary.com platform

Installation

npm install @binary-com/binary-document-uploader

Publishing a new version

With npm

First increase the version in package.json according to major/minor/patch. Ideally this will be done in the same PR as your changes. After that, you can run:

npm run build
npm publish

With yarn

Yarn automatically increases the version for you, so you only need to run:

yarn publish

The resulting DocumentUploader.js should be committed and uploaded to this repository.

Usage

ES6

import DocumentUploader from 'binary-document-uploader';

const uploader = new DocumentUploader(config);

RequireJS

const DocumentUploader = require('binary-document-uploader');

const uploader = new DocumentUploader(config);

Browser

<script src="./documentUploader.js"></script>
<script>
    const uploader = new DocumentUploader(config);
    uploader(file);
</script>

Example

import DocumentUploader from 'binary-document-uploader';

const uploader = new DocumentUploader(config);

uploader.upload(file)
    .then(result => console.log(`Status: ${result.status}`))
    .catch(error => console.log(error));

file (object)

File information and payload to send

file.filename

Filename

file.buffer

Array buffer containing the file to upload

file.documentType

Document type

file.documentId (optional)

Document id

file.documentFormat

Document format

file.expirationDate (optional)

Expiration date

file.chunkSize

Default: 16384 (16 KB)

config (object)

config.connection

A ready websocket connection

config.debug

Default: false

binary-document-uploader's People

Contributors

ashkanx avatar 4p00rv avatar negarn avatar ruskakimov avatar cakasuma avatar negar-binary avatar aminmarashi avatar dependabot[bot] 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.