# get()

Canonical URL: https://developers.iagenify.com/de/sdk/ref/storage/get/
Language: de

`api.storage.get({ id }) → Promise<ConnectedStorage | null>`

Ein Speicher, bereit zu verwenden. Ohne Argument, der Standard des Kontos.

Status: GET /api/storage/:id · free · null, never a throw

## Parameter {#parameters}

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `id` | string |  | Lassen Sie es für den Standard des Kontos aus. |

```javascript
const target = await api.storage.get();            // the default
const one = await api.storage.get({ id });         // a particular one
```

## Es antwortet eher auf null als auf das Werfen {#null}

Eine unbekannte ID, eine missgebildete oder eine andere Konto gehören alle geben `null`. Die Prüfung ist also ein Werttest, kein Versuch/catch — und `null` "Es ist das eines anderen".

```javascript
const storage = await api.storage.get({ id });

if (!storage) {
  throw new Error("that storage is not on this account");
}
```

## Dies, oder getStorage() {#versus}

|  | api.storage.get() | api.getStorage() |
| --- | --- | --- |
| Gibt | Eine vernetzte Lagerung mit Methoden | Vier Felder |
| Verwenden Sie es, um | Lesen, Schreiben, Listen-Dateien | zeigen, welche die Standardeinstellung ist |
| Das braucht eine ID | Ja | Nein — immer die Voreinstellung |

## Was man mit dem machen kann, was zurückkommt {#doing}

```javascript
const storage = await api.storage.get({ id });

// Any storage: read and write through run()
await storage.run({ action: "collections" });

// A computer only: its own files, on that machine
const pc = await api.storage.get({ id: computerId });
await pc.files.list();
```

> **Dateien und Terminals existieren nur auf einem Computer**
>
> Sie auf alles andere zu erreichen storage_not_local, und auf einem Telefon storage_is_phone — seine Dateien befinden sich in seinem Browser. Testen Sie Typ, bevor Sie erreichen.

```javascript
if (storage.type === "filesystem") {
  await storage.files.list();
} else {
  await storage.run({ action: "objects" });
}
```

## Was es trägt {#fields}

| Feld | Ist |
| --- | --- |
| id · Kennzeichnung | Identität und der Anzeigename. |
| Typ | Dateisystem · Telefon · Browser · Datenbank · Objekt |
| Anbieter · verwaltet | Was dahinter steckt und wer es betreibt. |
| Dienstleistung | nsql · sql · Objekt auf einem IaGenify Cloud-Speicher; andernfalls null. |
| isDefault | Ob ein Save ohne Ziel hier hinkommt. |
| maschineID · Hostname · GerätID | Auf einem Gerät: welches. |

Nichts trägt hier ein Credential: Was Sie bei der Verbindung bereitgestellt haben, wird vom Server verwendet und nicht zurückgereicht.

- [Vernetzte Lagerung](/de/sdk/ref/connected-storage): Alles auf dem Objekt, das das zurückgibt.
- [api.getStorage()](/de/sdk/ref/iagenify/get-storage): Die Standardeinstellung, als vier einfache Felder.

```python
target = api.storage.get()                # the default
one = api.storage.get(id=storage_id)      # a particular one
```

```python
storage = api.storage.get(id=storage_id)

if storage is None:
    raise LookupError("that storage is not on this account")
```

```python
storage = api.storage.get(id=storage_id)

# Any storage: read and write through run()
storage.run(action="collections")

# A computer only: its own files, on that machine
pc = api.storage.get(id=computer_id)
pc.files.list()
```

```python
if storage.type == "filesystem":
    storage.files.list()
else:
    storage.run(action="objects")
```
