api.storage

get()

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

Un storage, pronto per l'uso. Senza argumento, il default del conto.

GET /api/storage/:idfreenull, never a throw
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

Parâmetros

idstring

Quale stoccatura. Esclude-lo per il predefinit del cont.

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

Responde null e non lance

Un id sconosciut, un malformat, o un identificat di un altro conto, da null. Quindi il check è un test de valore, non un test/catch — e null non significa mai «è di qualcun altro».

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

if (!storage) {
  throw new Error("that storage is not on this account");
}
storage = api.storage.get(id=storage_id)

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

Isto, o getStorage()

api.storage.get()api.getStorage()
DàUn archivament connesso, con metodiQuattro campis simples
Usar-lo aleg, scrivi, list filesMostra qual è la predefinit
Prende un idsino — sempre il predefinit

Ce pots fare con ce che torna

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();
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()
Fichier e terminales existen solo in un computer

Assegnîs per loro su ningun altro get storage_not_local, e su un telefono storage_is_phone — i suoi files sono in suo browser. Teste tipo prima di arrivi.

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

Ce porta

CampoIs
id · étiquetteIdentità, e nome di mostra.
tiposistema de fiches · telefono · navegador · base de datos · objeto
provider · gestitByCenès isquit e chi lo opera.
servizioNosql · sql · objete su un IaGenify Storage cloud; null other.
isdefaultSe un salvatèn senza alza va aquí.
idmachine · nomede l'host · dispositivoSu un dispositivo: qual.

Nada qui porta un credential: quello che tu providenzis in connezion e usat dal servèr e non restituit.