How to send a file octet-stream type, adding the name?

There is a csv file format, it is sent to ga as a report.
const {google} = require('googleapis'), JWT = google.auth.JWT, analytics = google.analytics('v3')
const fs = require('fs')
const csvPath = __dirname + '/ga.csv'

analytics.management.uploads.uploadData({
 auth: authClient,
 'accountId': '1030160XX,
 'webPropertyId': 'UA-1030160XX-14',
 'media': {
 body: fs.createReadStream(csvPath), // 
 mimeType: 'application/octet-stream'
},
 'customDataSourceId': 'yFnhmnd5QlOVPq74CRRJxw'
 }, function (err, result) {
 console.log("err ---> ", err)
 console.log("result ---> ", result)
})


The content file is sent, but no file name. Looked at the contents of the library googleapis there at the entrance of the uploadData function are only body and mimeType settings. Therefore, assuming that fs.createReadStream(csvPath) you can add the name of the file.
April 4th 20 at 13:27
0 answer

Find more questions by tags Node.jsGoogle Analytics