twilio-functions-storage
v0.1.0
Published
Storage object for Twilio serverless functions.
Downloads
3
Maintainers
Readme
twilio-functions-storage
Storage object for Twilio serverless functions that is compatible with the Web Storage API.
Example
const Storage = require('twilio-functions-storage');
exports.handler = async function(context, event, callback) {
// create a storage object
const storage = Storage(context);
// get a variable
const test = storage.getItem('test');
// set a variable
storage.setItem('foo', 'bar');
// delete a variable
storage.removeItem('old');
// save() must be called before exiting to preserve changes
await storage.save();
callback();
}
Implementation Notes
Internally, this package uses Environment Variable
resources to permanently store data. All the variables created by this packaage
begin with the prefix S_
.
Limits
The following are the limitations of this implementation:
- Item values cannot be longer than 450 bytes.
- The Twilio Runtime allocate approximately 3KB for environment variable storage.