Stack (file)
Last updated
Was this helpful?
Last updated
Was this helpful?
In an Akord vault, files and other assets are organized as 'stacks'. A stack represents one single file and all the subsequent revisions that may come after.
create(vaultId, file, options)
vaultId
(string
, required)
file
(, required) - file object - web: File, node: NodeJs.File (Blob implementation; web like File)
options
(StackCreateOptions
, optional)
returns Promise<{ stackId, transactionId, uri }>
- Promise with new stack id & corresponding transaction id
import(vaultId, fileTxId)
Create new stack from an existing arweave file transaction:
vaultId
(string
, required)
fileTxId
(string
, required) - arweave file transaction id reference
options
(NodeCreateOptions
, optional) - parent id, etc.
returns Promise<{ stackId, transactionId }>
- Promise with new stack id & corresponding transaction id
rename(stackId, name)
stackId
(string
, required)
name
(string
, required) - new stack name
returns Promise<{ transactionId }>
- Promise with corresponding transaction id
uploadRevision(stackId, file)
stackId
(string
, required)
options
(FileUploadOptions
, optional)
returns Promise<{ transactionId }>
- Promise with corresponding transaction id
revoke(stackId)
stackId
(string
, required)
returns Promise<{ transactionId }>
- Promise with corresponding transaction id
move(stackId, parentId)
stackId
(string
, required)
parentId
(string
, required) - new parent folder id
returns Promise<{ transactionId }>
- Promise with corresponding transaction id
restore(stackId)
stackId
(string
, required)
returns Promise<{ transactionId }>
- Promise with corresponding transaction id
delete(stackId)
stackId
(string
, required)
returns Promise<{ transactionId }>
- Promise with corresponding transaction id
get(stackId, options)
stackId
(string
, required)
returns Promise<Stack>
- Promise with the stack object
listAll(vaultId, options)
vaultId
(string
, required)
returns Promise<Array<Stack>>
- Promise with all stacks within given vault
list(vaultId, options)
vaultId
(string
, required)
returns Promise<{ items, nextToken }>
- Promise with paginated stacks within given vault
getVersion(stackId, index)
Get file stack version by index, return the latest version by default:
stackId
(string
, required)
index
(number
, optional) - file version index
returns Promise<{ name: string, data: ArrayBuffer }>
- Promise with file name & data buffer
getUri(stackId, type, index)
Get stack file uri by index, return the latest arweave uri by default:
stackId
(string
, required)
index
(number
, optional) - file version index, default to latest
returns Promise<string>
- Promise with stack file uri
file
(, required) - file object
options
( optional)
options
(, optional)
options
(, optional)
type
(, optional) - storage type, default to arweave