New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@web-lite/storage

Package Overview
Dependencies
Maintainers
6
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web-lite/storage - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

package.json
{
"name": "@web-lite/storage",
"version": "0.0.1",
"version": "0.0.2",
"description": "TypeScript client for Weblite S3 Storage",

@@ -5,0 +5,0 @@ "main": "build/main/index.js",

@@ -1,3 +0,63 @@

# weblite-storage
# Weblite Storage Client
TypeScript client for Weblite S3 Storage
TypeScript client for Weblite S3 Storage
## API
```typescript
declare const upload: (file: File, { name, type, meta, compression, onProgress, }?: {
name?: string; // default: file.name
type?: 'file' | 'voice' | 'image' | 'infer'; // default: `file`
meta?: Record<string, unknown>; // use it carefully!
compression?: CompressorOptions; // applied only if `type` = `image`, will be passed to compressorjs
onProgress?: (fileId: string, { sent, total }: {
sent: number;
total: number;
}) => void;
}) => Promise<{
fileId: string;
fileName: string;
size: number;
type: 'file' | 'voice' | 'image';
contentType: string;
createdAt: Date;
}>
/*
returns `true` if successfully canceled
returns `false` if:
- file has been completely uploaded
- file has been already canceled
- fileId is not valid
*/
declare const cancelUpload: (fileId: string) => boolean
declare const getDownloadLink: (fileId: string) => string
declare const getInfo: (fileId: string) => Promise<{
fileName: string;
size: number;
contentType: string;
meta: Record<string, unknown>;
directUrl: string;
}>
```
## Usage
```typescript
import * as storage from '@web-lite/storage'
const uploadImage = async (image: File): Promise<void> => {
const { fileId } = await storage.upload(file, {
type: 'image',
compression: { quality: 0.5 },
})
const info = await storage.getInfo(fileId)
console.log(info)
}
const image = selectImage()
uploadImage(image)
```
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