File Management

Manage your files efficiently with code

Add the logic to create, update, rename, and remove files directly into your application.

Upload a new file to your storage with the metadata you specify.

TSstorage.ts
1import { Storage } from '@cloud/storage';2 3const storage = new Storage('st_xxxxxxxxx');4 5// Create a new file6const file = await storage.files.create({7  name: 'document.pdf',8  path: '/documents/',9  size: 1024000,10  type: 'application/pdf',11  // Optional metadata12  metadata: {13    author: 'John Doe',14    tags: ['important', 'archive'],15  },16});17 18console.log('File created:', file.id);