By using node sdk , file is uploaded and then after uploading file , I would like to get that uploaded file id. File is uploaded successfully response code s200. Althought I try out , I cannot get that uploaded file id. I cannot understand how can I get data from return Promise<Object> data type.
Therefore, could you support and find out solution for that issue. My code snippest is as below.
// Initialize the Box SDK
var sdk = new BoxSDK({
clientID: sdkConfig.clientID,
clientSecret: sdkConfig.clientSecret,
appAuth: {
keyID: sdkConfig.appAuth.keyID,
privateKey: sdkConfig.appAuth.privateKey,
passphrase: sdkConfig.appAuth.passphrase
}
});
var appUserClient = sdk.getAppAuthClient('user',userId);
var stream =fs.createReadStream(newPath); // upload file’s path
var parentFolderId = parentFolderId
var fileName = files.upload[0].originalFilename; // upload file’s name
// File is uploaded
var response = appUserClient.files.uploadFile(parentFolderId,fileName,stream);
// want to accept uploaded file’s id that step ※