const userId = 'user_123'
const fileBits = ['profile-pic-content']
const fileName = 'profile-pic.png'
const file = new File(fileBits, fileName, { type: 'image/png' })
const params = {
file,
}
const response = await clerkClient.users.updateUserProfileImage(userId, params)
console.log(response)
/*
_User {
id: 'user_123',
passwordEnabled: false,
totpEnabled: false,
backupCodeEnabled: false,
twoFactorEnabled: false,
banned: false,
locked: false,
createdAt: 1719935072474,
updatedAt: 1719935170538,
imageUrl: 'https://img.clerk.com/eyJ...',
hasImage: true,
primaryEmailAddressId: 'idn_123',
primaryPhoneNumberId: null,
primaryWeb3WalletId: null,
lastSignInAt: 1719935072492,
externalId: null,
username: null,
firstName: 'Test',
lastName: 'Clerk',
publicMetadata: {},
privateMetadata: {},
unsafeMetadata: {},
emailAddresses: [
_EmailAddress {
id: 'idn_123',
emailAddress: 'test@gmail.com',
verification: [_Verification],
linkedTo: [Array]
}
],
phoneNumbers: [],
web3Wallets: [],
externalAccounts: [
_ExternalAccount {
id: 'idn_123',
provider: undefined,
identificationId: undefined,
externalId: undefined,
approvedScopes: 'email https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile openid profile',
emailAddress: 'test@gmail.com',
firstName: undefined,
lastName: undefined,
imageUrl: '',
username: null,
publicMetadata: {},
label: null,
verification: [_Verification]
}
],
samlAccounts: [],
lastActiveAt: 1719935072472,
createOrganizationEnabled: true
}
*/