@uplo/node
v0.25.1
Published
Maintainers
Readme
@uplo/node
Node.js entry point for Uplo — handle file uploads to S3, Google Cloud Storage and more, with ORM adapter support.
Installation
npm i @uplo/nodeUsage
import { createPrismaAdapter } from '@uplo/adapter-prisma'
import { createUplo } from '@uplo/node'
import { createS3Service } from '@uplo/service-s3'
const config = {
privateKey: process.env.APPLICATION_SECRET, // Signs direct upload IDs, at least 32 bytes
signedIdExpiresIn: 60 * 60, // Time how long a Signed ID is valid
}
const uplo = createUplo({
config,
adapter: createPrismaAdapter({ prisma }),
services: {
s3: createS3Service({
isPublic: false,
region: process.env.AWS_REGION,
bucket: process.env.AWS_BUCKET,
accessKeyId: '*****',
secretAccessKey: '*****',
}),
},
attachments: {},
})Blob inputs
Node-specific helpers for attaching files:
import { blobFileInput, blobStringInput, blobBufferInput } from '@uplo/node'
const fileInput = await blobFileInput({ path: '/home/images/image.png' })
await uplo.attachments.user(123).avatar.attachFile(fileInput)Documentation
See the full docs at uplo.js.org.
