Hi Team good day, could you help me please
I am trying to read one file into my box Folder Company , but seem I am not able to reach it , it is telling me access denied
var BoxSDK = require(‘box-node-sdk’);
var sdkConfig = require(‘…/Bromont.json’);
var sdk = BoxSDK.getPreconfiguredInstance(sdkConfig);
var client = sdk.getAppAuthClient(‘enterprise’)
var fs = require(‘fs’);
client.users.get(client.CURRENT_USER_ID)
.then(user => console.log(‘Hello’, user.name, ‘!’))
.catch(err => console.log(‘Got an error!’, err));
var client = sdk.getAppAuthClient(‘enterprise’);
client.files.getReadStream(‘1339534847387’, null, function(error, stream) {
const chunks = b];
stream.on('data', function(chunk) {
chunks.push(chunk);
});
stream.on('end', () => {
var result = Buffer.concat(chunks);
var sal=result.toString('base64')
fs.writeFile('newfile.txt', sal, function (err) {
if (err) throw err;
console.log('File is created successfully.');
});
})
});