Answer the question
In order to leave comments, you need to log in
TypeError: Not a buffer - how to resolve this error?
I'm trying to upload a file to amazon using aws.
AWS.config.credentials = new AWS.Credentials(
options.accessKeyId,
options.secretAccessKey,
null
)
this.s3 = new AWS.S3()
var fileBuff = new Buffer( file )
this.s3.upload( {
Bucket: this.getBucket(obj),
Key: obj.name+'.txt',
Body: fileBuff })
.on( 'httpUploadProgress', function(evt) { console.log(evt) })
.send( function(err, data) {
console.log( err )
console.log( data )
callback( err, data )
})
console.log( fileBuff )
<Buffer 74 65 78 74>
Answer the question
In order to leave comments, you need to log in
The problem was in the AWS.config.credentials settings. The solution is mindfulness...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question