File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -32,25 +32,38 @@ Visit our [official API documentation](https://docs.squarecloud.app/blob-referen
3232
3333## Getting Started
3434
35+ - _ Login and get your API Key at [ https://squarecloud.app/account ] ( https://squarecloud.app/account ) ._
36+
3537``` ts
3638import { SquareCloudBlob } from " @squarecloud/blob"
37- // const { SquareCloudBlob } = require("@squarecloud/blob");
39+ // CommonJS => const { SquareCloudBlob } = require("@squarecloud/blob");
3840
3941const blob = new SquareCloudBlob (" Your API Key" )
4042const objects = await blob .objects .list ()
4143```
4244
4345### Creating an object
4446
47+ - _ Check supported file types [ here] ( https://docs.squarecloud.app/services/blob#supported-file-types ) ._
48+
4549``` ts
46- const object = await blob .objects .put ({ file: " path/to/file.png" , name: " my_image" })
47- console .log (object .url )
50+ const blobObject = await blob .objects .put ({
51+ file: " path/to/file.png" , // Absolute path to your file, Buffer or Blob
52+ name: " my_image.png" // File name with extension
53+ })
54+
55+ console .log (blobObject .url )
4856```
4957
5058### Deleting objects
5159
5260``` ts
53- const objectsToDelete = [" ID/prefix/name1_xxx-xxx.zip" , " ID/prefix/name_xxx-xxx-xxx.png" ]
61+ // List of objects to delete (Limit of 100 per request)
62+ const objectsToDelete = [
63+ " ID/prefix/name1_xxx-xxx.mp4" ,
64+ " ID/prefix/name_xxx-xxx-xxx.png"
65+ ]
66+
5467await blob .objects .delete (objectsToDelete )
5568```
5669
You can’t perform that action at this time.
0 commit comments