New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ublob

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ublob

Helper module for working with files.

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

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

  • Website: martikavagyan.com
  • Twitter: @martikavagyan
  • GitHub: @m-avagyan

License

MIT

Keywords

npm

FAQs

Package last updated on 16 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts