Skip to content
Sites Hackathon is live / Aug 29 - Sep 12
Back to Changelog

JavaScript SDKs now use object arguments

We've updated the Appwrite JavaScript SDKs to support object-based arguments instead of positional ones.

This change makes SDK calls easier to read, less error-prone, and more maintainable.

Before (positional arguments):

JavaScript
const result = storage.getFilePreview(
  '<BUCKET_ID>',
  '<FILE_ID>',
  undefined, // width
  undefined, // height
  ImageGravity.Center,
  undefined, // quality
  undefined, // borderWidth
  undefined, // borderColor
  undefined, // borderRadius
  undefined, // opacity
  undefined, // rotation
  undefined, // background
  ImageFormat.Jpg,
  '<TOKEN>'
);
// Required passing undefined for unused optional parameters

After (object arguments):

JavaScript
const result = storage.getFilePreview({
  bucketId: '<BUCKET_ID>',
  fileId: '<FILE_ID>',
  gravity: ImageGravity.Center,
  output: ImageFormat.Jpg,
  token: '<TOKEN>'
});
// No more undefined values needed!
What about existing code?

Positional arguments still work, but they've been marked as deprecated. Your IDE will show warnings, and you can migrate over time.

This update is now available in the following SDK versions:

Join the discussion on Discord

Start building with Appwrite today

Get started

Our plans

  • Free

    $0

    A great fit for passion projects and small applications.

    Get started
  • Pro

    Most popular
    From
    $25
    /month

    For production applications that need powerful functionality and resources to scale.

    Start building
  • Scale

    From
    $599
    /month

    For teams that handle more complex and large projects and need more control and support.

    Start building
  • Enterprise

    Custom

    For enterprises that need more power and premium support.

    Contact us