A Storage plugin is a node.js module that exposes the following functions on its
module.exports
.
Function | Description |
---|---|
Storage.init(settings) | initialise the storage system |
Storage.getFlows() | get the flow configuration |
Storage.saveFlows(flows) | save the flow configuration |
Storage.getCredentials() | get the flow credentials |
Storage.saveCredentials(credentials) | save the flow credentials |
Storage.getSettings() | get the user settings |
Storage.saveSettings(settings) | save the user settings |
Storage.getSessions() | get the user sessions |
Storage.saveSessions(sessions) | save the user sessions |
Storage.getLibraryEntry(type,name) | get a type-specific library entry |
Storage.saveLibraryEntry(type,name,meta,body) | save a type-specific library entry |
Initialise the storage system.
Argument | Description |
---|---|
settings | the runtime settings |
Returns a promise that resolves when the storage system is initialised.
Returns a promise that resolves with the runtime flow configuration.
Argument | Description |
---|---|
flows | the flow configuration object, can be serialised as JSON. |
Returns a promise that resolves when the flow configuration has been saved.
Returns a promise that resolves with the runtime flow credentials.
Argument | Description |
---|---|
credentials | the credentials object, can be serialised as JSON. |
Returns a promise that resolves when the flow credentials have been saved.
Returns a promise that resolves with the user settings.
Argument | Description |
---|---|
settings | the settings object, can be serialised as JSON. |
Returns a promise that resolves when the settings have been saved.
Returns a promise that resolves with the sessions object.
Argument | Description |
---|---|
sessions | the sessions object, can be serialised as JSON. |
Returns a promise that resolves when the sessions have been saved.
Nodes that register a library type allow the user to save and retrieve content in a local library. The following functions of the storage module are used to access this content.
Entries may have metadata associated with them, for example, a function
entry
includes metadata identifying how many outputs the function provides.
Argument | Description |
---|---|
type | the type of library entry, eg flows , functions , templates |
name | the pathname of the entry to return |
Returns a promise that resolves with the result.
If name
represents to a single entry, the result is the content of the entry.
For example, the code of a function.
If name
represents to a logical directory, the result is a directory listing array.
Each element of the array is either a string (representing subdirectories that can
be browsed) or is an object with a fn
property providing the entry’s filename,
as well as any other metadata associated with the entry.
Argument | Description |
---|---|
type | the type of library entry, eg flows , functions , templates |
name | the pathname of the entry |
meta | an object containing additional metadata to save with the entry |
body | the body of the entry |
Returns a promise that resolves when the entry has been saved.
Prior to version 0.10.7, the following functions were also used by storage modules.
New implementations of this interface should not implement these functions.
The runtime will use them if they are present for backwards compatibility, but
will otherwise use getLibraryEntry/saveLibraryEntry
with their type
argument
set to 'flows'
.
Returns a promise that resolves to an object containing a complete listing of all flows in the library.
Returns a promise that resolves to the content of a flow.
Returns a promise that resolves when flow is saved to the library.
Node-RED: Low-code programming for event-driven applications.
Copyright OpenJS Foundation and Node-RED contributors. All rights reserved. The OpenJS Foundation has registered trademarks and uses trademarks. For a list of trademarks of the OpenJS Foundation, please see our Trademark Policy and Trademark List. Trademarks and logos not indicated on the list of OpenJS Foundation trademarks are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
The OpenJS Foundation | Terms of Use | Privacy Policy | OpenJS Foundation Bylaws | Trademark Policy | Trademark List | Cookie Policy