Skip to main content

Getting Started

Installing

You can install aircampi's storage via NPM, Yarn or CDN.

NPM:

  npm install @aircampi/storage

Yarn:

  yarn add @aircampi/storage

CDN:

  <script src="https://cdn.jsdelivr.net/npm/@aircampi/storage"/>

//or

<script src="https://unpkg.com/@aircampi/storage"/>

Find the source code on GitHub.

Initializing

There are 2 way to initialize new client.

Using createStorageClient():


import { createStorageClient } from '@aircampi/storage'

// Create a Storage client for interacting with your storage stack

const storage = createStorageClient({
domain: '<YOUR_DOMAIN>',
client_id: '<YOUR_CLIENT_ID>'
})

Using StorageClient object


import { StorageClient } from '@aircampi/storage';

const storage = new StorageClient({
domain: '<YOUR_DOMAIN>',
client_id: '<YOUR_CLIENT_ID>'
});

//if you do this, you'll need to get list of buckets

try {
await storage.getBuckets();
} catch (error) {
if (error.error !== 'login_required') {
throw error;
}
}