How to pass a loop counter as an object property

I am trying to add an id as an object property but i must be missing something important.

function appendData(products) {
var i = 0;
var productsPromises = products.map(function(product) {
    i++;
    var title = product['title'];
    var stock = product['stock'];
    var price = product['price'];
    var write = {Titulo: title, i: {Stock: stock, Price: price, date: date}};
    var readFiles = fs.readFile('./XXXXX/' + i, 'utf8', function(err, data){
        if (err) {
            console.log(err);
        }
        console.log(data);
    });


});
return Promise.all(productsPromises);
};

You can't do that in a JavaScript object literal. Create the object and then add the property as a separate statement:

var write = {Titulo: title };
write[i] = {Stock: stock, Price: price, date: date};

Also note that .map() will pass your callback function the array index as the second parameter, so you don't have to maintain your own counter.