lingapp-file
v1.0.1
Published
Mongoose model for managing files in the LingApp system with S3 support
Maintainers
Readme
lingapp-file
A Mongoose model for file management with S3 integration.
Installation
npm install lingapp-fileUsage
import { File } from 'lingapp-file';
// Create a new file
const file = await File.create({
size: 1024,
name: 'example.pdf',
key: 'path/to/file.pdf',
url: 'https://example.com/file.pdf'
});
// Find a file
const file = await File.findById(id);
// Delete a file (will also delete from S3 if STORAGE_TYPE is 's3')
await File.deleteOne({ _id: id });Environment Variables
The following environment variables are required when using S3 storage:
STORAGE_TYPE: Set to 's3' to enable S3 integrationAWS_REGION: Your AWS regionAWS_ACCESS_KEY_ID: Your AWS access keyAWS_SECRET_ACCESS_KEY: Your AWS secret keyBUCKET_NAME: Your S3 bucket name
License
MIT
