Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uppy/utils

Package Overview
Dependencies
Maintainers
5
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uppy/utils

Shared utility functions for Uppy Core and plugins maintained by the Uppy team.

  • 6.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
302K
increased by15.44%
Maintainers
5
Weekly downloads
 
Created

What is @uppy/utils?

@uppy/utils is a utility library that provides a set of helper functions for working with files, URLs, and other common tasks in JavaScript. It is part of the Uppy file uploader ecosystem and is designed to simplify various operations related to file handling and manipulation.

What are @uppy/utils's main functionalities?

getFileNameAndExtension

This function extracts the file name and extension from a given file path or URL.

const { getFileNameAndExtension } = require('@uppy/utils');
const { name, extension } = getFileNameAndExtension('example.txt');
console.log(name); // 'example'
console.log(extension); // 'txt'

getSafeFileName

This function sanitizes a file name by replacing unsafe characters with safe ones.

const { getSafeFileName } = require('@uppy/utils');
const safeName = getSafeFileName('example file.txt');
console.log(safeName); // 'example-file.txt'

generateFileID

This function generates a unique ID for a file based on its properties such as name, type, and size.

const { generateFileID } = require('@uppy/utils');
const fileID = generateFileID({ name: 'example.txt', type: 'text/plain', size: 1024 });
console.log(fileID); // A unique file ID based on the file's properties

isPreviewSupported

This function checks if a given MIME type is supported for preview.

const { isPreviewSupported } = require('@uppy/utils');
const supported = isPreviewSupported('image/jpeg');
console.log(supported); // true

Other packages similar to @uppy/utils

Keywords

FAQs

Package last updated on 05 Dec 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc