Hey everybody! I have a really old project of mine running with an amazing code tip from @shantanukumar847 . This snipped was able to import CSV to any collection from any page (so that users were able to import massive amounts of data into my databases). Apparently Wix has made ’ request-promise ’ NPM unavailable and i’m unable to make this code work anymore .
Does anyone came up with a solution for this issue?
Link to Shan’s original post.
Thanks!
John P.
PS: I already tried setting up other “promise” NPM package but none of them worked nearly as smoothly as the old ’ request-promise ’ NPM.
Solved:
Well, apparently I was going to crazy trying to find a solution. Simply just using the ’ request ’ instead of ’ request-promise ’ NPM seemed to work perfectly, since no “promise” at all was being used.
Thanks for the tip @wixgle and sorry to disturb.
Page Code:
import { mediaManager } from 'wix-media-backend';
import request from "request";
import { csv } from 'csvtojson';
export function converterArquivoCSV(url) {
return csv()
.fromStream(request.get(url))
.then((json) => {
return json;
});
}
export async function getFileUrl(mediaId) {
return mediaManager.getFileUrl(mediaId);
}