JavaScript SDK 0.5.0



  • Implemented ObjectStore and ObjectStoreEntry classes for interacting with Fastly ObjectStore (#110)
  • add btoa and atob native implementations (#227) (8b8c31f)

Object-store support

This release adds support for Fastly Object-store, which is globally consistent key-value storage accessible across the Fastly Network. This makes it possible for your Fastly Compute application to read and write from Object-stores.

We've added two classes, ObjectStore, and ObjectStoreEntry. ObjectStore is used to interact with a particular Object-store and ObjectStoreEntry is a particular value within an Object-store. We've made ObjectStoreEntry have a similar API as Response to make it simpler to read and write from Object-stores. I.e. ObjectStoreEntry has a body property which is a ReadableStream and has arrayBuffer/json/text methods - just like Response.

The way to use these classes is best shown with an example:

async function app(event) {
// Create a connection the the Object-store named 'example-store'
const store = new ObjectStore('example-store')
// Create or update the 'hello' key with the contents 'world'
await store.put('hello', 'world')
// Retrieve the contents of the 'hello' key
// Note: Object-stores are eventually consistent, this means that the updated contents associated may not be available to read from all
// Fastly edge locations immediately and some edge locations may continue returning the previous contents associated with the key.
const hello = await store.get('hello')
// Read the contents of the `hello` key into a string
const hellotext = await hello.text()
return new Response(hellotext)
addEventListener("fetch", event => {

Added btoa and atob global functions

These two functions enable you to encode to (btoa) and decode from (atob) Base64 strings. They follow the same specification as the atob and btoa functions that exist in web-browsers.

addEventListener("fetch", event => {
event.respondWith(new Response(atob(btoa('hello from fastly'))))

Improved Console Support

Previously our console methods only supported a single argument and would convert the argument to a string via String(argument), this unfortunately made it difficult to log out complex objects such as Request objects or similar.

We've updated our console methods and they now support any number of arguments. As well as supporting any number of arguments, we've also changed the implementation to have better support for logging out complex objects.

This is a before and after example of what happens when logging a Request with our console methods.


const request = new Request('', {body:'I am the body', method: 'POST'});
console.log(request); // outputs `[object Object]`.


const request = new Request('', {body:'I am the body', method: 'POST'});
console.log(request); // outputs `Request: {method: POST, url:, version: 2, headers: {}, body: null, bodyUsed: false}`.


  • Improved console output for all types (#204)

Prior change: Allow skipping billing address verification checks

Following change: JavaScript SDK 0.5.1