Socket
Book a DemoInstallSign in
Socket

@placeos/cloud-uploads

Package Overview
Dependencies
Maintainers
4
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@placeos/cloud-uploads

Signed direct to cloud uploads

latest
Source
npmnpm
Version
1.0.6
Version published
Weekly downloads
66
312.5%
Maintainers
4
Weekly downloads
 
Created
Source

Typescript Cloud Uploads Library

To be used in conjuction with Comdominios.

Introduction

This project is a library for handling secure direct to cloud uploads that are managed by the Condominios project. At Place we use it to handle all of our file ingestion as it:

  • takes the load away from our API servers

  • allows us to support hybrid cloud models

  • works seamlessly with AWS Lambda and Google Cloud Functions

  • Manages an upload queue with pause, resume and progress for each upload

  • Supports configuring individual upload parallelism and the number of simultaneous uploads

  • All files are hashed in webworkers before upload for data integrity

  • Communicates with Condominios to obtain signed requests for the uploads

Usage

Install the node package with npm install @placeos/cloud-uploads

Initialise the service in your code before using it.

import { initialiseUploadService, Amazon } from '@placeos/cloud-uploads';

function bootstrap() {
    initialiseUploadService({
        auto_start: true,
        token: 'access_token',
        endpoint: '/api/engine/v2/uploads',
        worker_url: 'assets/md5_worker.js',
        providers: [Amazon] as any,
    });
}

Load file data into browser and call the method to upload the file.

import { uploadFiles, Upload } from '@placeos/cloud-uploads';

function uploadFile(file: File) {
    const fileReader = new FileReader();
    fileReader.addEventListener('loadend', (e: any) => {
        const arrayBuffer = e.target.result;
        const blob = blobUtil.arrayBufferToBlob(arrayBuffer, file.type);
        const [upload] = uploadFiles([blob], { file_name: file.name });
        ...
    });
    fileReader.readAsArrayBuffer(file);
}

Upload type provides an obserable for the status/progress of the upload

const [upload] = uploadFiles([blob], { file_name: file.name });
upload.subscribe((state) => (state.status === 'error' ? console.log('Status:', state.error) : console.log('Status:', state.status)));

Keywords

placeos

FAQs

Package last updated on 14 Aug 2025

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