Skip to content

miguelgrinberg/twilio-functions-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 package 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 allocates approximately 3KB for environment variable storage.

About

Storage object for Twilio serverless functions that is compatible with the Web Storage API.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published