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!

This update is now available in the following SDK versions:

Ready to build?_