1.0.1 • Published 7 months ago

ublob v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

ublob

Helper module for working with files.

Installation

npm install ublob --save

or

yarn add ublob

Usage

  • toBase64: convert file to base 64 string
import { toBase64 } from "ublob";

toBase64(file)
  .catch((error) => console.log(error))
  .then((blob) =>
    // set blob data...
  );
  • getFileType: getting the file type
import { getFileType, toBase64 } from "ublob";

toBase64(file)
  .catch((error) => console.log(error))
  .then((blob) =>
    const fileType = getFileType(blob);
    // set file type to your state
  );
  • open: open blob url in browser new tab
import { open } from "ublob";

const handleOpen = (blob) =>
  open(blob, {
    title: "Ublob PDF",
    width: "100%",
    height: "100%",
  });
  • getAvailableFileTypes: getting the available file types
import { getAvailableFileTypes } from "ublob";

const availableFileTypes = getAvailableFileTypes();
// use this list where you want

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Author

Martik Avagyan

License

MIT

1.0.1

7 months ago

1.0.0

7 months ago

0.1.0

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago