@squarecloud/blob
Official Square Cloud Blob SDK for NodeJS.
Installation
npm install @squarecloud/blob
// or
yarn add @squarecloud/blob
// or
pnpm add @squarecloud/blob
Documentation
Visit our official API documentation for more information about this service.
Getting Started
import { SquareCloudBlob } from "@squarecloud/blob"
const blob = new SquareCloudBlob("Your API Key")
const objects = await blob.objects.list()
Creating an object
- Check supported file types here.
const blobObject = await blob.objects.create({
file: "path/to/file.png",
name: "my_image",
})
console.log(blobObject.url)
Advanced usage with Buffer
import { MimeTypes } from "@squarecloud/blob"
const blobObject = await blob.objects.create({
file: Buffer.from("content"),
name: "my_image",
mimeType: MimeTypes.IMAGE_JPEG,
})
console.log(blobObject.url)
Deleting objects
const objectsToDelete = [
"ID/prefix/name1_xxx-xxx.mp4",
"ID/prefix/name_xxx-xxx-xxx.png"
]
await blob.objects.delete(objectsToDelete)
Mime types handling
- Check supported file types here.
import { MimeTypeUtil } from "@squarecloud/blob"
console.log(MimeTypeUtil.fromExtension("jpeg"))
console.log(MimeTypeUtil.fromExtension("json"))
console.log(MimeTypeUtil.fromExtension("potato"))
Contributing
Feel free to contribute with suggestions or bug reports at our GitHub repository.
Authors