Skip to content
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 like a team of hundreds today_

Free
$0

A great fit for passion projects and small applications.

Start project
Pro Popular
$25 /month

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

Start project
Enterprise
Custom

For enterprises that need more power and premium support.

Contact us