2.0.14 • Published 28 days ago

@thirdweb-dev/storage v2.0.14

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
28 days ago

Installation

Install the latest version of the SDK with either npm or yarn:

npm install @thirdweb-dev/storage
yarn add @thirdweb-dev/storage

Quick Start

Once you have the thirdweb Storage SDK installed, you can use it to easily upload and download files and other data using decentralized storage systems.

Here's a simple example using the SDK to upload and download a file from IPFS:

import { ThirdwebStorage } from "@thirdweb-dev/storage";

// First, instantiate the SDK
const storage = new ThirdwebStorage();

// Now we can upload a file and get the upload URI
const file = readFileSync("path/to/file.jpg");
const uri = await storage.upload(file);

// Finally we can download the file data again
const res = await storage.download(uri);
const data = await res.text();

Alternatively, we can use the SDK to upload and download metadata and JSON objects, and we can also upload multiple items at once:

// We define metadata for 2 different NFTs
const metadata = [
  {
    name: "NFT #1",
    description: "This is my first NFT",
    image: readFileSync("path/to/file.jpg"),
    properties: {
      coolness: 100,
    },
  },
  {
    name: "NFT #2",
    description: "This is my second NFT",
    image: readFileSync("path/to/file.jpg"),
    properties: {
      coolness: 200,
    },
  },
];

// And now we can upload it all at once to a single directory
const uris = await storage.uploadBatch(metadata);

// And easily retrieve the metadata
const metadata = await storage.downloadJSON(uris);

Learn More

You can learn more about thirdweb and the Storage SDK with the following resources:

2.0.14

28 days ago

2.0.13

1 month ago

2.0.12

1 month ago

2.0.11

2 months ago

2.0.10

2 months ago

2.0.9

3 months ago

2.0.8

5 months ago

2.0.7

5 months ago

2.0.6

5 months ago

1.2.10

8 months ago

1.2.11

7 months ago

1.2.0

10 months ago

1.2.8

9 months ago

1.2.7

9 months ago

1.2.6

9 months ago

1.2.5

9 months ago

1.2.4

9 months ago

1.2.3

9 months ago

1.2.2

9 months ago

1.2.1

9 months ago

2.0.3

6 months ago

2.0.2

6 months ago

2.0.5

6 months ago

2.0.4

6 months ago

2.0.1

7 months ago

2.0.0

7 months ago

1.1.9

10 months ago

1.1.8

10 months ago

1.1.7

10 months ago

1.1.6

10 months ago

1.2.9

8 months ago

1.1.5

10 months ago

1.1.4

11 months ago

1.1.3

12 months ago

1.1.1

1 year ago

1.1.0

1 year ago

1.1.2

1 year ago

1.0.9

1 year ago

1.0.10

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.8

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.1.0

2 years ago